mirror of
https://gitclone.com/github.com/MetaCubeX/Clash.Meta
synced 2024-11-16 14:11:19 +08:00
23 lines
486 B
Go
23 lines
486 B
Go
|
package route
|
||
|
|
||
|
var (
|
||
|
ErrUnauthorized = newError("Unauthorized")
|
||
|
ErrBadRequest = newError("Body invalid")
|
||
|
ErrForbidden = newError("Forbidden")
|
||
|
ErrNotFound = newError("Resource not found")
|
||
|
ErrRequestTimeout = newError("Timeout")
|
||
|
)
|
||
|
|
||
|
// HTTPError is custom HTTP error for API
|
||
|
type HTTPError struct {
|
||
|
Message string `json:"message"`
|
||
|
}
|
||
|
|
||
|
func (e *HTTPError) Error() string {
|
||
|
return e.Message
|
||
|
}
|
||
|
|
||
|
func newError(msg string) *HTTPError {
|
||
|
return &HTTPError{Message: msg}
|
||
|
}
|