-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror_code.go
More file actions
41 lines (32 loc) · 1.34 KB
/
error_code.go
File metadata and controls
41 lines (32 loc) · 1.34 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package restapi
// Error codes start at 1000 to leave room below for application-specific codes
// that should not collide with HTTP status integers (which live in 100-599).
// When a consumer extends this set, it should start its own range (for example
// 2000+) to avoid colliding with the codes defined here.
const (
// CodeBadRequest [HTTP 400] signals a malformed request that cannot be
// parsed or validated by the handler.
CodeBadRequest int = iota + 1000
// CodeUnauthorized [HTTP 401] signals missing or invalid authentication
// credentials.
CodeUnauthorized
// CodeForbidden [HTTP 403] signals that the caller is authenticated but
// not allowed to perform the action.
CodeForbidden
// CodeNotFound [HTTP 404] signals that the requested resource does not
// exist.
CodeNotFound
// CodeConflict [HTTP 409] signals a conflict with the current state of
// the resource.
CodeConflict
// CodeValidationFailed [HTTP 422] signals that the request was
// syntactically valid but failed business validation.
CodeValidationFailed
// CodeTooManyRequests [HTTP 429] signals a rate-limit rejection.
CodeTooManyRequests
// CodeInternal [HTTP 500] is the safe fallback used when an unknown code
// is requested or when a panic is recovered.
CodeInternal
// CodeUnavailable [HTTP 503] signals a transient downstream failure.
CodeUnavailable
)