✨ Add 401 and 403 default errors
This commit is contained in:
parent
bf9a0a1bfd
commit
0e12c479be
2 changed files with 29 additions and 5 deletions
10
new.go
10
new.go
|
|
@ -20,6 +20,16 @@ func NewBadRequest(format string, parts ...any) SettableError {
|
|||
return Errorf(http.StatusBadRequest, format, parts...)
|
||||
}
|
||||
|
||||
// A 401 error with the error message "Unauthorized"
|
||||
func NewUnauthorized() SettableError {
|
||||
return Errorf(http.StatusUnauthorized, "Unauthorized")
|
||||
}
|
||||
|
||||
// A 403 error with the error message "Forbidden"
|
||||
func NewForbidden() SettableError {
|
||||
return Errorf(http.StatusForbidden, "Forbidden")
|
||||
}
|
||||
|
||||
// Represents a 500 error. For this error, the user error is preset to "Unknown Error".
|
||||
func NewInternalError(format string, parts ...any) SettableError {
|
||||
status := http.StatusInternalServerError
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue