gRPC  0.6.0
 All Classes Namespaces Functions Variables Enumerations Properties Pages
status_code_enum.h
1 /*
2  *
3  * Copyright 2015, Google Inc.
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are
8  * met:
9  *
10  * * Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * * Redistributions in binary form must reproduce the above
13  * copyright notice, this list of conditions and the following disclaimer
14  * in the documentation and/or other materials provided with the
15  * distribution.
16  * * Neither the name of Google Inc. nor the names of its
17  * contributors may be used to endorse or promote products derived from
18  * this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  */
33 
34 #ifndef GRPCXX_STATUS_CODE_ENUM_H
35 #define GRPCXX_STATUS_CODE_ENUM_H
36 
37 namespace grpc {
38 
39 enum StatusCode {
40  /* Not an error; returned on success */
41  OK = 0,
42 
43  /* The operation was cancelled (typically by the caller). */
44  CANCELLED = 1,
45 
46  /* Unknown error. An example of where this error may be returned is
47  if a Status value received from another address space belongs to
48  an error-space that is not known in this address space. Also
49  errors raised by APIs that do not return enough error information
50  may be converted to this error. */
51  UNKNOWN = 2,
52 
53  /* 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  INVALID_ARGUMENT = 3,
58 
59  /* Deadline expired before operation could complete. For operations
60  that change the state of the system, this error may be returned
61  even if the operation has completed successfully. For example, a
62  successful response from a server could have been delayed long
63  enough for the deadline to expire. */
64  DEADLINE_EXCEEDED = 4,
65 
66  /* Some requested entity (e.g., file or directory) was not found. */
67  NOT_FOUND = 5,
68 
69  /* Some entity that we attempted to create (e.g., file or directory)
70  already exists. */
71  ALREADY_EXISTS = 6,
72 
73  /* The caller does not have permission to execute the specified
74  operation. PERMISSION_DENIED must not be used for rejections
75  caused by exhausting some resource (use RESOURCE_EXHAUSTED
76  instead for those errors). PERMISSION_DENIED must not be
77  used if the caller can not be identified (use UNAUTHENTICATED
78  instead for those errors). */
79  PERMISSION_DENIED = 7,
80 
81  /* The request does not have valid authentication credentials for the
82  operation. */
83  UNAUTHENTICATED = 16,
84 
85  /* Some resource has been exhausted, perhaps a per-user quota, or
86  perhaps the entire file system is out of space. */
87  RESOURCE_EXHAUSTED = 8,
88 
89  /* Operation was rejected because the system is not in a state
90  required for the operation's execution. For example, directory
91  to be deleted may be non-empty, an rmdir operation is applied to
92  a non-directory, etc.
93 
94  A litmus test that may help a service implementor in deciding
95  between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE:
96  (a) Use UNAVAILABLE if the client can retry just the failing call.
97  (b) Use ABORTED if the client should retry at a higher-level
98  (e.g., restarting a read-modify-write sequence).
99  (c) Use FAILED_PRECONDITION if the client should not retry until
100  the system state has been explicitly fixed. E.g., if an "rmdir"
101  fails because the directory is non-empty, FAILED_PRECONDITION
102  should be returned since the client should not retry unless
103  they have first fixed up the directory by deleting files from it.
104  (d) Use FAILED_PRECONDITION if the client performs conditional
105  REST Get/Update/Delete on a resource and the resource on the
106  server does not match the condition. E.g., conflicting
107  read-modify-write on the same resource. */
108  FAILED_PRECONDITION = 9,
109 
110  /* The operation was aborted, typically due to a concurrency issue
111  like sequencer check failures, transaction aborts, etc.
112 
113  See litmus test above for deciding between FAILED_PRECONDITION,
114  ABORTED, and UNAVAILABLE. */
115  ABORTED = 10,
116 
117  /* Operation was attempted past the valid range. E.g., seeking or
118  reading past end of file.
119 
120  Unlike INVALID_ARGUMENT, this error indicates a problem that may
121  be fixed if the system state changes. For example, a 32-bit file
122  system will generate INVALID_ARGUMENT if asked to read at an
123  offset that is not in the range [0,2^32-1], but it will generate
124  OUT_OF_RANGE if asked to read from an offset past the current
125  file size.
126 
127  There is a fair bit of overlap between FAILED_PRECONDITION and
128  OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific
129  error) when it applies so that callers who are iterating through
130  a space can easily look for an OUT_OF_RANGE error to detect when
131  they are done. */
132  OUT_OF_RANGE = 11,
133 
134  /* Operation is not implemented or not supported/enabled in this service. */
135  UNIMPLEMENTED = 12,
136 
137  /* Internal errors. Means some invariants expected by underlying
138  system has been broken. If you see one of these errors,
139  something is very broken. */
140  INTERNAL = 13,
141 
142  /* The service is currently unavailable. This is a most likely a
143  transient condition and may be corrected by retrying with
144  a backoff.
145 
146  See litmus test above for deciding between FAILED_PRECONDITION,
147  ABORTED, and UNAVAILABLE. */
148  UNAVAILABLE = 14,
149 
150  /* Unrecoverable data loss or corruption. */
151  DATA_LOSS = 15,
152 
153  /* Force users to include a default branch: */
154  DO_NOT_USE = -1
155 };
156 
157 } // namespace grpc
158 
159 #endif // GRPCXX_STATUS_CODE_ENUM_H
StatusCode
Result of a remote procedure call. Based on grpc_status_code from grpc/status.h
Definition: StatusCode.cs:42