@@ -33,34 +33,49 @@ const (
33
33
OK Code = 0
34
34
35
35
// Canceled indicates the operation was canceled (typically by the caller).
36
+ //
37
+ // The gRPC framework will generate this error code when cancellation
38
+ // is requested.
36
39
Canceled Code = 1
37
40
38
41
// Unknown error. An example of where this error may be returned is
39
42
// if a Status value received from another address space belongs to
40
43
// an error-space that is not known in this address space. Also
41
44
// errors raised by APIs that do not return enough error information
42
45
// may be converted to this error.
46
+ //
47
+ // The gRPC framework will generate this error code in the above two
48
+ // mentioned cases.
43
49
Unknown Code = 2
44
50
45
51
// InvalidArgument indicates client specified an invalid argument.
46
52
// Note that this differs from FailedPrecondition. It indicates arguments
47
53
// that are problematic regardless of the state of the system
48
54
// (e.g., a malformed file name).
55
+ //
56
+ // This error code will not be generated by the gRPC framework.
49
57
InvalidArgument Code = 3
50
58
51
59
// DeadlineExceeded means operation expired before completion.
52
60
// For operations that change the state of the system, this error may be
53
61
// returned even if the operation has completed successfully. For
54
62
// example, a successful response from a server could have been delayed
55
63
// long enough for the deadline to expire.
64
+ //
65
+ // The gRPC framework will generate this error code when the deadline is
66
+ // exceeded.
56
67
DeadlineExceeded Code = 4
57
68
58
69
// NotFound means some requested entity (e.g., file or directory) was
59
70
// not found.
71
+ //
72
+ // This error code will not be generated by the gRPC framework.
60
73
NotFound Code = 5
61
74
62
75
// AlreadyExists means an attempt to create an entity failed because one
63
76
// already exists.
77
+ //
78
+ // This error code will not be generated by the gRPC framework.
64
79
AlreadyExists Code = 6
65
80
66
81
// PermissionDenied indicates the caller does not have permission to
@@ -69,10 +84,17 @@ const (
69
84
// instead for those errors). It must not be
70
85
// used if the caller cannot be identified (use Unauthenticated
71
86
// instead for those errors).
87
+ //
88
+ // This error code will not be generated by the gRPC core framework,
89
+ // but expect authentication middleware to use it.
72
90
PermissionDenied Code = 7
73
91
74
92
// ResourceExhausted indicates some resource has been exhausted, perhaps
75
93
// a per-user quota, or perhaps the entire file system is out of space.
94
+ //
95
+ // This error code will be generated by the gRPC framework in
96
+ // out-of-memory and server overload situations, or when a message is
97
+ // larger than the configured maximum size.
76
98
ResourceExhausted Code = 8
77
99
78
100
// FailedPrecondition indicates operation was rejected because the
@@ -94,6 +116,8 @@ const (
94
116
// REST Get/Update/Delete on a resource and the resource on the
95
117
// server does not match the condition. E.g., conflicting
96
118
// read-modify-write on the same resource.
119
+ //
120
+ // This error code will not be generated by the gRPC framework.
97
121
FailedPrecondition Code = 9
98
122
99
123
// Aborted indicates the operation was aborted, typically due to a
@@ -102,6 +126,8 @@ const (
102
126
//
103
127
// See litmus test above for deciding between FailedPrecondition,
104
128
// Aborted, and Unavailable.
129
+ //
130
+ // This error code will not be generated by the gRPC framework.
105
131
Aborted Code = 10
106
132
107
133
// OutOfRange means operation was attempted past the valid range.
@@ -119,15 +145,26 @@ const (
119
145
// error) when it applies so that callers who are iterating through
120
146
// a space can easily look for an OutOfRange error to detect when
121
147
// they are done.
148
+ //
149
+ // This error code will not be generated by the gRPC framework.
122
150
OutOfRange Code = 11
123
151
124
152
// Unimplemented indicates operation is not implemented or not
125
153
// supported/enabled in this service.
154
+ //
155
+ // This error code will be generated by the gRPC framework. Most
156
+ // commonly, you will see this error code when a method implementation
157
+ // is missing on the server. It can also be generated for unknown
158
+ // compression algorithms or a disagreement as to whether an RPC should
159
+ // be streaming.
126
160
Unimplemented Code = 12
127
161
128
162
// Internal errors. Means some invariants expected by underlying
129
163
// system has been broken. If you see one of these errors,
130
164
// something is very broken.
165
+ //
166
+ // This error code will be generated by the gRPC framework in several
167
+ // internal error conditions.
131
168
Internal Code = 13
132
169
133
170
// Unavailable indicates the service is currently unavailable.
@@ -137,13 +174,22 @@ const (
137
174
//
138
175
// See litmus test above for deciding between FailedPrecondition,
139
176
// Aborted, and Unavailable.
177
+ //
178
+ // This error code will be generated by the gRPC framework during
179
+ // abrupt shutdown of a server process or network connection.
140
180
Unavailable Code = 14
141
181
142
182
// DataLoss indicates unrecoverable data loss or corruption.
183
+ //
184
+ // This error code will not be generated by the gRPC framework.
143
185
DataLoss Code = 15
144
186
145
187
// Unauthenticated indicates the request does not have valid
146
188
// authentication credentials for the operation.
189
+ //
190
+ // The gRPC framework will generate this error code when the
191
+ // authentication metadata is invalid or a Credentials callback fails,
192
+ // but also expect authentication middleware to generate it.
147
193
Unauthenticated Code = 16
148
194
149
195
_maxCode = 17
0 commit comments