-
Notifications
You must be signed in to change notification settings - Fork 232
/
errors.go
27 lines (25 loc) · 6.07 KB
/
errors.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package clientgen
type ErrCode struct {
Name string
Comment string
HttpStatusCode int
}
var errorCodes []ErrCode = []ErrCode{
{"OK", "OK indicates the operation was successful.", 200},
{"Canceled", "Canceled indicates the operation was canceled (typically by the caller).\n\nEncore will generate this error code when cancellation is requested.", 499},
{"Unknown", "Unknown error. An example of where this error may be returned is\nif a Status value received from another address space belongs to\nan error-space that is not known in this address space. Also\nerrors raised by APIs that do not return enough error information\nmay be converted to this error.\n\nEncore will generate this error code in the above two mentioned cases.", 500},
{"InvalidArgument", "InvalidArgument indicates client specified an invalid argument.\nNote that this differs from FailedPrecondition. It indicates arguments\nthat are problematic regardless of the state of the system\n(e.g., a malformed file name).\n\nThis error code will not be generated by the gRPC framework.", 400},
{"DeadlineExceeded", "DeadlineExceeded means operation expired before completion.\nFor operations that change the state of the system, this error may be\nreturned even if the operation has completed successfully. For\nexample, a successful response from a server could have been delayed\nlong enough for the deadline to expire.\n\nThe gRPC framework will generate this error code when the deadline is\nexceeded.", 504},
{"NotFound", "NotFound means some requested entity (e.g., file or directory) was\nnot found.\n\nThis error code will not be generated by the gRPC framework.", 404},
{"AlreadyExists", "AlreadyExists means an attempt to create an entity failed because one\nalready exists.\n\nThis error code will not be generated by the gRPC framework.", 409},
{"PermissionDenied", "PermissionDenied indicates the caller does not have permission to\nexecute the specified operation. It must not be used for rejections\ncaused by exhausting some resource (use ResourceExhausted\ninstead for those errors). It must not be\nused if the caller cannot be identified (use Unauthenticated\ninstead for those errors).\n\nThis error code will not be generated by the gRPC core framework,\nbut expect authentication middleware to use it.", 403},
{"ResourceExhausted", "ResourceExhausted indicates some resource has been exhausted, perhaps\na per-user quota, or perhaps the entire file system is out of space.\n\nThis error code will be generated by the gRPC framework in\nout-of-memory and server overload situations, or when a message is\nlarger than the configured maximum size.", 429},
{"FailedPrecondition", "FailedPrecondition indicates operation was rejected because the\nsystem is not in a state required for the operation's execution.\nFor example, directory to be deleted may be non-empty, an rmdir\noperation is applied to a non-directory, etc.\n\nA litmus test that may help a service implementor in deciding\nbetween FailedPrecondition, Aborted, and Unavailable:\n (a) Use Unavailable if the client can retry just the failing call.\n (b) Use Aborted if the client should retry at a higher-level\n (e.g., restarting a read-modify-write sequence).\n (c) Use FailedPrecondition if the client should not retry until\n the system state has been explicitly fixed. E.g., if an \"rmdir\"\n fails because the directory is non-empty, FailedPrecondition\n should be returned since the client should not retry unless\n they have first fixed up the directory by deleting files from it.\n (d) Use FailedPrecondition if the client performs conditional\n REST Get/Update/Delete on a resource and the resource on the\n server does not match the condition. E.g., conflicting\n read-modify-write on the same resource.\n\nThis error code will not be generated by the gRPC framework.", 400},
{"Aborted", "Aborted indicates the operation was aborted, typically due to a\nconcurrency issue like sequencer check failures, transaction aborts,\netc.\n\nSee litmus test above for deciding between FailedPrecondition,\nAborted, and Unavailable.", 409},
{"OutOfRange", "OutOfRange means operation was attempted past the valid range.\nE.g., seeking or reading past end of file.\n\nUnlike InvalidArgument, this error indicates a problem that may\nbe fixed if the system state changes. For example, a 32-bit file\nmay be rotated to a 64-bit file without error.\n\nThere is a fair bit of overlap between FailedPrecondition and\nOutOfRange. We recommend using OutOfRange (the more specific\nerror) when it applies so that callers who are iterating through\na space can easily look for an OutOfRange error to detect when\nthey are done.\n\nThis error code will not be generated by the gRPC framework.", 400},
{"Unimplemented", "Unimplemented indicates operation is not implemented or not\nsupported/enabled in this service.\n\nThis is not an error, but a feature not available.\n\nThis error code will not be generated by the gRPC framework.", 501},
{"Internal", "Internal means some invariant expected by the underlying system has\nbeen broken. This is not a per-message error, it is a global\nconditions check.\n\nThis error code will not be generated by the gRPC framework.", 500},
{"Unavailable", "Unavailable indicates the service is currently unavailable.\nThis is most likely a transient condition, which can be corrected by\nretrying with a backoff.\n\nSee litmus test above for deciding between FailedPrecondition,\nAborted, and Unavailable.", 503},
{"DataLoss", "DataLoss indicates unrecoverable data loss or corruption.\n\nThis error code is only defined in the gRPC library, and only for\nunrecoverable data loss (i.e., data loss resulting from errors\nlike hard disk corruption or bandwidth exceeded).\n\nThis error code will not be generated by the gRPC framework.", 500},
{"Unauthenticated", "Unauthenticated indicates the request does not have valid\nauthentication credentials for the operation.\n\nThe gRPC framework will generate this error code when the\nauthentication metadata is invalid or a Credentials callback fails,\nbut also expect authentication middleware to generate it.", 401},
}