1# Copyright 2015 gRPC authors. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15# GRPC contains the General RPC module. 16module GRPC 17 module Core 18 # StatusCodes defines the canonical error codes used by gRPC for the RPC 19 # API. 20 module StatusCodes 21 # OK is returned on success. 22 OK = 0 23 24 # Canceled indicates the operation was canceled (typically by the caller). 25 CANCELLED = 1 26 27 # Unknown error. An example of where this error may be returned is if a 28 # Status value received from another address space belongs to an 29 # error-space that is not known in this address space. Also errors raised 30 # by APIs that do not return enough error information may be converted to 31 # this error. 32 UNKNOWN = 2 33 34 # InvalidArgument indicates client specified an invalid argument. Note 35 # that this differs from FailedPrecondition. It indicates arguments that 36 # are problematic regardless of the state of the system (e.g., a malformed 37 # file name). 38 INVALID_ARGUMENT = 3 39 40 # DeadlineExceeded means operation expired before completion. For 41 # operations that change the state of the system, this error may be 42 # returned even if the operation has completed successfully. For example, 43 # a successful response from a server could have been delayed long enough 44 # for the deadline to expire. 45 DEADLINE_EXCEEDED = 4 46 47 # NotFound means some requested entity (e.g., file or directory) was not 48 # found. 49 NOT_FOUND = 5 50 51 # AlreadyExists means an attempt to create an entity failed because one 52 # already exists. 53 ALREADY_EXISTS = 6 54 55 # PermissionDenied indicates the caller does not have permission to 56 # execute the specified operation. It must not be used for rejections 57 # caused by exhausting some resource (use ResourceExhausted instead for 58 # those errors). It must not be used if the caller cannot be identified 59 # (use Unauthenticated instead for those errors). 60 PERMISSION_DENIED = 7 61 62 # ResourceExhausted indicates some resource has been exhausted, perhaps a 63 # per-user quota, or perhaps the entire file system is out of space. 64 RESOURCE_EXHAUSTED = 8 65 66 # FailedPrecondition indicates operation was rejected because the system 67 # is not in a state required for the operation's execution. For example, 68 # directory to be deleted may be non-empty, an rmdir operation is applied 69 # to a non-directory, etc. 70 # 71 # A litmus test that may help a service implementor in deciding between 72 # FailedPrecondition, Aborted, and Unavailable: 73 # (a) Use Unavailable if the client can retry just the failing call. 74 # (b) Use Aborted if the client should retry at a higher-level (e.g., 75 # restarting a read-modify-write sequence). 76 # (c) Use FailedPrecondition if the client should not retry until the 77 # system state has been explicitly fixed. E.g., if an "rmdir" fails 78 # because the directory is non-empty, FailedPrecondition should be 79 # returned since the client should not retry unless they have first 80 # fixed up the directory by deleting files from it. 81 # (d) Use FailedPrecondition if the client performs conditional REST 82 # Get/Update/Delete on a resource and the resource on the server does 83 # not match the condition. E.g., conflicting read-modify-write on the 84 # same resource. 85 FAILED_PRECONDITION = 9 86 87 # Aborted indicates the operation was aborted, typically due to a 88 # concurrency issue like sequencer check failures, transaction aborts, 89 # etc. 90 # 91 # See litmus test above for deciding between FailedPrecondition, Aborted, 92 # and Unavailable. 93 ABORTED = 10 94 95 # OutOfRange means operation was attempted past the valid range. E.g., 96 # seeking or reading past end of file. 97 # 98 # Unlike InvalidArgument, this error indicates a problem that may be fixed 99 # if the system state changes. For example, a 32-bit file system will 100 # generate InvalidArgument if asked to read at an offset that is not in 101 # the range [0,2^32-1], but it will generate OutOfRange if asked to read 102 # from an offset past the current file size. 103 # 104 # There is a fair bit of overlap between FailedPrecondition and 105 # OutOfRange. We recommend using OutOfRange (the more specific error) when 106 # it applies so that callers who are iterating through a space can easily 107 # look for an OutOfRange error to detect when they are done. 108 OUT_OF_RANGE = 11 109 110 # Unimplemented indicates operation is not implemented or not 111 # supported/enabled in this service. 112 UNIMPLEMENTED = 12 113 114 # Internal errors. Means some invariants expected by underlying system has 115 # been broken. If you see one of these errors, something is very broken. 116 INTERNAL = 13 117 118 # Unavailable indicates the service is currently unavailable. This is a 119 # most likely a transient condition and may be corrected by retrying with 120 # a backoff. Note that it is not always safe to retry non-idempotent 121 # operations. 122 # 123 # See litmus test above for deciding between FailedPrecondition, Aborted, 124 # and Unavailable. 125 UNAVAILABLE = 14 126 127 # DataLoss indicates unrecoverable data loss or corruption. 128 DATA_LOSS = 15 129 130 # Unauthenticated indicates the request does not have valid authentication 131 # credentials for the operation. 132 UNAUTHENTICATED = 16 133 end 134 end 135end 136