Files
tun2socks/internal/api/errors.go
xjasonlyu e1e96c8cfb v2
2020-11-05 18:41:15 +08:00

25 lines
562 B
Go

// Clash: https://github.com/Dreamacro/clash/blob/master/hub/route/errors.go
package api
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}
}