mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
add new REST errors.
This commit is contained in:
parent
b6d5df6d04
commit
bff779aee7
@ -45,7 +45,16 @@ func ErrInvalidRequest(err error) render.Renderer {
|
||||
}
|
||||
}
|
||||
|
||||
func ErrRender(err error) render.Renderer {
|
||||
func ErrInternalServer(err error) render.Renderer {
|
||||
return &ErrResponse{
|
||||
Err: err,
|
||||
HTTPStatusCode: 500,
|
||||
StatusText: "Internal server error.",
|
||||
ErrorText: err.Error(),
|
||||
}
|
||||
}
|
||||
|
||||
func ErrNot(err error) render.Renderer {
|
||||
return &ErrResponse{
|
||||
Err: err,
|
||||
HTTPStatusCode: 422,
|
||||
@ -54,6 +63,16 @@ func ErrRender(err error) render.Renderer {
|
||||
}
|
||||
}
|
||||
|
||||
var ErrNotAuthenticated = &ErrResponse{
|
||||
HTTPStatusCode: 401,
|
||||
StatusText: "Invalid or missing access token.",
|
||||
}
|
||||
|
||||
var ErrNotAuthorized = &ErrResponse{
|
||||
HTTPStatusCode: 403,
|
||||
StatusText: "Access token does not have the required scope.",
|
||||
}
|
||||
|
||||
var ErrNotFound = &ErrResponse{
|
||||
HTTPStatusCode: 404,
|
||||
StatusText: "Resource not found.",
|
||||
|
Loading…
Reference in New Issue
Block a user