...
1// Copyright 2017 Google Inc.
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
15syntax = "proto3";
16
17package google.rpc;
18
19option go_package = "google.golang.org/genproto/googleapis/rpc/code;code";
20option java_multiple_files = true;
21option java_outer_classname = "CodeProto";
22option java_package = "com.google.rpc";
23option objc_class_prefix = "RPC";
24
25
26// The canonical error codes for Google APIs.
27//
28//
29// Sometimes multiple error codes may apply. Services should return
30// the most specific error code that applies. For example, prefer
31// `OUT_OF_RANGE` over `FAILED_PRECONDITION` if both codes apply.
32// Similarly prefer `NOT_FOUND` or `ALREADY_EXISTS` over `FAILED_PRECONDITION`.
33enum Code {
34 // Not an error; returned on success
35 //
36 // HTTP Mapping: 200 OK
37 OK = 0;
38
39 // The operation was cancelled, typically by the caller.
40 //
41 // HTTP Mapping: 499 Client Closed Request
42 CANCELLED = 1;
43
44 // Unknown error. For example, this error may be returned when
45 // a `Status` value received from another address space belongs to
46 // an error space that is not known in this address space. Also
47 // errors raised by APIs that do not return enough error information
48 // may be converted to this error.
49 //
50 // HTTP Mapping: 500 Internal Server Error
51 UNKNOWN = 2;
52
53 // The client specified an invalid argument. Note that this differs
54 // from `FAILED_PRECONDITION`. `INVALID_ARGUMENT` indicates arguments
55 // that are problematic regardless of the state of the system
56 // (e.g., a malformed file name).
57 //
58 // HTTP Mapping: 400 Bad Request
59 INVALID_ARGUMENT = 3;
60
61 // The deadline expired before the operation could complete. For operations
62 // that change the state of the system, this error may be returned
63 // even if the operation has completed successfully. For example, a
64 // successful response from a server could have been delayed long
65 // enough for the deadline to expire.
66 //
67 // HTTP Mapping: 504 Gateway Timeout
68 DEADLINE_EXCEEDED = 4;
69
70 // Some requested entity (e.g., file or directory) was not found.
71 //
72 // Note to server developers: if a request is denied for an entire class
73 // of users, such as gradual feature rollout or undocumented whitelist,
74 // `NOT_FOUND` may be used. If a request is denied for some users within
75 // a class of users, such as user-based access control, `PERMISSION_DENIED`
76 // must be used.
77 //
78 // HTTP Mapping: 404 Not Found
79 NOT_FOUND = 5;
80
81 // The entity that a client attempted to create (e.g., file or directory)
82 // already exists.
83 //
84 // HTTP Mapping: 409 Conflict
85 ALREADY_EXISTS = 6;
86
87 // The caller does not have permission to execute the specified
88 // operation. `PERMISSION_DENIED` must not be used for rejections
89 // caused by exhausting some resource (use `RESOURCE_EXHAUSTED`
90 // instead for those errors). `PERMISSION_DENIED` must not be
91 // used if the caller can not be identified (use `UNAUTHENTICATED`
92 // instead for those errors). This error code does not imply the
93 // request is valid or the requested entity exists or satisfies
94 // other pre-conditions.
95 //
96 // HTTP Mapping: 403 Forbidden
97 PERMISSION_DENIED = 7;
98
99 // The request does not have valid authentication credentials for the
100 // operation.
101 //
102 // HTTP Mapping: 401 Unauthorized
103 UNAUTHENTICATED = 16;
104
105 // Some resource has been exhausted, perhaps a per-user quota, or
106 // perhaps the entire file system is out of space.
107 //
108 // HTTP Mapping: 429 Too Many Requests
109 RESOURCE_EXHAUSTED = 8;
110
111 // The operation was rejected because the system is not in a state
112 // required for the operation's execution. For example, the directory
113 // to be deleted is non-empty, an rmdir operation is applied to
114 // a non-directory, etc.
115 //
116 // Service implementors can use the following guidelines to decide
117 // between `FAILED_PRECONDITION`, `ABORTED`, and `UNAVAILABLE`:
118 // (a) Use `UNAVAILABLE` if the client can retry just the failing call.
119 // (b) Use `ABORTED` if the client should retry at a higher level
120 // (e.g., when a client-specified test-and-set fails, indicating the
121 // client should restart a read-modify-write sequence).
122 // (c) Use `FAILED_PRECONDITION` if the client should not retry until
123 // the system state has been explicitly fixed. E.g., if an "rmdir"
124 // fails because the directory is non-empty, `FAILED_PRECONDITION`
125 // should be returned since the client should not retry unless
126 // the files are deleted from the directory.
127 //
128 // HTTP Mapping: 400 Bad Request
129 FAILED_PRECONDITION = 9;
130
131 // The operation was aborted, typically due to a concurrency issue such as
132 // a sequencer check failure or transaction abort.
133 //
134 // See the guidelines above for deciding between `FAILED_PRECONDITION`,
135 // `ABORTED`, and `UNAVAILABLE`.
136 //
137 // HTTP Mapping: 409 Conflict
138 ABORTED = 10;
139
140 // The operation was attempted past the valid range. E.g., seeking or
141 // reading past end-of-file.
142 //
143 // Unlike `INVALID_ARGUMENT`, this error indicates a problem that may
144 // be fixed if the system state changes. For example, a 32-bit file
145 // system will generate `INVALID_ARGUMENT` if asked to read at an
146 // offset that is not in the range [0,2^32-1], but it will generate
147 // `OUT_OF_RANGE` if asked to read from an offset past the current
148 // file size.
149 //
150 // There is a fair bit of overlap between `FAILED_PRECONDITION` and
151 // `OUT_OF_RANGE`. We recommend using `OUT_OF_RANGE` (the more specific
152 // error) when it applies so that callers who are iterating through
153 // a space can easily look for an `OUT_OF_RANGE` error to detect when
154 // they are done.
155 //
156 // HTTP Mapping: 400 Bad Request
157 OUT_OF_RANGE = 11;
158
159 // The operation is not implemented or is not supported/enabled in this
160 // service.
161 //
162 // HTTP Mapping: 501 Not Implemented
163 UNIMPLEMENTED = 12;
164
165 // Internal errors. This means that some invariants expected by the
166 // underlying system have been broken. This error code is reserved
167 // for serious errors.
168 //
169 // HTTP Mapping: 500 Internal Server Error
170 INTERNAL = 13;
171
172 // The service is currently unavailable. This is most likely a
173 // transient condition, which can be corrected by retrying with
174 // a backoff.
175 //
176 // See the guidelines above for deciding between `FAILED_PRECONDITION`,
177 // `ABORTED`, and `UNAVAILABLE`.
178 //
179 // HTTP Mapping: 503 Service Unavailable
180 UNAVAILABLE = 14;
181
182 // Unrecoverable data loss or corruption.
183 //
184 // HTTP Mapping: 500 Internal Server Error
185 DATA_LOSS = 15;
186}
View as plain text