# google-cloud-errors - Class Google::Cloud::FailedPreconditionError (v1.6.0)

1.6.0 (latest) 1.5.0 1.4.0 1.3.1 1.2.0 Reference documentation and code samples for the google-cloud-errors class Google::Cloud::FailedPreconditionError.

FailedPrecondition indicates operation was rejected because the
system is not in a state required for the operation's execution.
For example, directory to be deleted may be non-empty, an rmdir
operation is applied to a non-directory, etc.


<br />

A litmus test that may help a service implementor in deciding
between FailedPrecondition, Aborted, and Unavailable:
(a) Use Unavailable if the client can retry just the failing call.
(b) Use Aborted if the client should retry at a higher-level
(e.g., restarting a read-modify-write sequence).
(c) Use FailedPrecondition if the client should not retry until
the system state has been explicitly fixed. E.g., if an "rmdir"
fails because the directory is non-empty, FailedPrecondition
should be returned since the client should not retry unless
they have first fixed up the directory by deleting files from it.
(d) Use FailedPrecondition if the client performs conditional
REST Get/Update/Delete on a resource and the resource on the
server does not match the condition. E.g., conflicting
read-modify-write on the same resource.

## Inherits

- [Google::Cloud::Error](https://docs.cloud.google.com/ruby/docs/reference/google-cloud-errors/latest/Google-Cloud-Error)

## Methods

### #code

    def code() -> Integer

gRPC error code for FAILED_PRECONDITION
**Returns**

- (Integer)