-
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy patherror_defaults.go
59 lines (49 loc) · 1.81 KB
/
error_defaults.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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Copyright © 2023 Ory Corp
// SPDX-License-Identifier: Apache-2.0
package herodot
import (
"net/http"
"google.golang.org/grpc/codes"
)
var ErrNotFound = DefaultError{
StatusField: http.StatusText(http.StatusNotFound),
ErrorField: "The requested resource could not be found",
CodeField: http.StatusNotFound,
GRPCCodeField: codes.NotFound,
}
var ErrUnauthorized = DefaultError{
StatusField: http.StatusText(http.StatusUnauthorized),
ErrorField: "The request could not be authorized",
CodeField: http.StatusUnauthorized,
GRPCCodeField: codes.Unauthenticated,
}
var ErrForbidden = DefaultError{
StatusField: http.StatusText(http.StatusForbidden),
ErrorField: "The requested action was forbidden",
CodeField: http.StatusForbidden,
GRPCCodeField: codes.PermissionDenied,
}
var ErrInternalServerError = DefaultError{
StatusField: http.StatusText(http.StatusInternalServerError),
ErrorField: "An internal server error occurred, please contact the system administrator",
CodeField: http.StatusInternalServerError,
GRPCCodeField: codes.Internal,
}
var ErrBadRequest = DefaultError{
StatusField: http.StatusText(http.StatusBadRequest),
ErrorField: "The request was malformed or contained invalid parameters",
CodeField: http.StatusBadRequest,
GRPCCodeField: codes.InvalidArgument,
}
var ErrUnsupportedMediaType = DefaultError{
StatusField: http.StatusText(http.StatusUnsupportedMediaType),
ErrorField: "The request is using an unknown content type",
CodeField: http.StatusUnsupportedMediaType,
GRPCCodeField: codes.InvalidArgument,
}
var ErrConflict = DefaultError{
StatusField: http.StatusText(http.StatusConflict),
ErrorField: "The resource could not be created due to a conflict",
CodeField: http.StatusConflict,
GRPCCodeField: codes.FailedPrecondition,
}