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