mirror of
https://github.com/xjasonlyu/tun2socks.git
synced 2025-10-05 16:56:54 +08:00
22 lines
381 B
Go
22 lines
381 B
Go
package restapi
|
|
|
|
var (
|
|
ErrUnauthorized = newError("Unauthorized")
|
|
ErrBadRequest = newError("Body invalid")
|
|
)
|
|
|
|
var _ error = (*HTTPError)(nil)
|
|
|
|
// 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}
|
|
}
|