Documentation ¶
Index ¶
- Variables
- type HTTPError
- func (e HTTPError) Error() string
- func (e HTTPError) GetError() error
- func (e HTTPError) GetMsg() string
- func (e HTTPError) NewCT(ct string) HTTPError
- func (e HTTPError) NewError(err error) HTTPError
- func (e HTTPError) NewMsg(msg string, args ...interface{}) HTTPError
- func (e HTTPError) Unwrap() error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrMissingContentType = errors.New("missing the header 'Content-Type'") ErrRendererNotRegistered = errors.New("renderer not registered") ErrInvalidRedirectCode = errors.New("invalid redirect status code") ErrInvalidSession = errors.New("invalid session") ErrSessionNotExist = errors.New("session does not exist") ErrNoSessionSupport = errors.New("no session support") ErrNoResponder = errors.New("no responder") )
Some non-HTTP Errors
View Source
var ( ErrBadRequest = NewHTTPError(http.StatusBadRequest) ErrForbidden = NewHTTPError(http.StatusForbidden) ErrNotFound = NewHTTPError(http.StatusNotFound) ErrMethodNotAllowed = NewHTTPError(http.StatusMethodNotAllowed) ErrStatusNotAcceptable = NewHTTPError(http.StatusNotAcceptable) ErrRequestTimeout = NewHTTPError(http.StatusRequestTimeout) ErrStatusConflict = NewHTTPError(http.StatusConflict) ErrStatusGone = NewHTTPError(http.StatusGone) ErrStatusRequestEntityTooLarge = NewHTTPError(http.StatusRequestEntityTooLarge) ErrUnsupportedMediaType = NewHTTPError(http.StatusUnsupportedMediaType) ErrTooManyRequests = NewHTTPError(http.StatusTooManyRequests) ErrInternalServerError = NewHTTPError(http.StatusInternalServerError) ErrStatusNotImplemented = NewHTTPError(http.StatusNotImplemented) ErrBadGateway = NewHTTPError(http.StatusBadGateway) ErrStatusGatewayTimeout = NewHTTPError(http.StatusGatewayTimeout) ErrStatusHTTPVersionNotSupported = NewHTTPError(http.StatusHTTPVersionNotSupported) )
Some HTTP error.
View Source
var ErrSkip = errors.New("skip")
ErrSkip is not an error, which is used to suggest that the middeware should skip and return it back to the outer middleware to handle.
Notice: it is only a suggestion.
Functions ¶
This section is empty.
Types ¶
type HTTPError ¶
HTTPError represents an error with HTTP Status Code.
func NewHTTPError ¶
NewHTTPError returns a new HTTPError.
func (HTTPError) GetError ¶
GetError returns the inner error.
If Err is nil but Msg is not "", return `errors.New(e.Msg)` instead; Or return nil.
HTTPError{Err: errors.New("")}.GetError() != nil HTTPError{Msg: "xxx"}.GetError() != nil HTTPError{Code: 200}.GetError() == nil
Click to show internal directories.
Click to hide internal directories.