Skip to content

Commit 8dd2ad1

Browse files
committed
Fetch protos
1 parent e58d337 commit 8dd2ad1

File tree

4 files changed

+547
-0
lines changed

4 files changed

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

0 commit comments

Comments
 (0)