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