-
Notifications
You must be signed in to change notification settings - Fork 0
/
codes.go
31 lines (23 loc) · 1.37 KB
/
codes.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
28
29
30
31
package derp
// Derp recommends, but does not require, using HTTP status codes as error messages.
// The values used in derp functions are enumerated here.
const (
// CodeBadRequestError indicates that the request is not properly formatted.
// https://www.rfc-editor.org/rfc/rfc9110.html#name-400-bad-request
CodeBadRequestError = 400
// CodeUnauthorizedError indicates that the request requires user authentication.
// https://www.rfc-editor.org/rfc/rfc9110.html#name-401-unauthorized
CodeUnauthorizedError = 401
// CodeForbiddenError means that the current user does not have the required permissions to access the requested resource.
// https://www.rfc-editor.org/rfc/rfc9110.html#name-403-forbidden
CodeForbiddenError = 403
// CodeNotFoundError represents a request for a resource that does not exist, such as a database query that returns "not found"
// https://www.rfc-editor.org/rfc/rfc9110.html#name-404-not-found
CodeNotFoundError = 404
// CodeValidationError retpresents a request that contains invalid data.
// https://www.rfc-editor.org/rfc/rfc9110.html#name-422-unprocessable-content
CodeValidationError = 422
// CodeInternalError represents a generic error message, given when an unexpected condition was encountered and no more specific message is suitable.
// https://www.rfc-editor.org/rfc/rfc9110.html#name-500-internal-server-error
CodeInternalError = 500
)