Documentation
¶
Index ¶
- Variables
- func As(err error, target interface{}) bool
- func AsInvalidArgumentError(err error, s string, args ...interface{}) error
- func AsInvalidValueError(err error, s string, args ...interface{}) error
- func AsMissingFieldError(err error, s string, args ...interface{}) error
- func AsNotImplementedError(err error, s string, args ...interface{}) error
- func AsValidator(err error) (errors.Validator, bool)
- func AsWebError(err error) web.Error
- func BackTrace(skip int) errors.Stack
- func CodeIsRedirect(code int) bool
- func ErrInvalidArgument(s string, args ...interface{}) error
- func ErrInvalidValue(s string, args ...interface{}) error
- func ErrMissingField(s string, args ...interface{}) error
- func ErrNotImplemented(s string, args ...interface{}) error
- func ErrorContext(ctx context.Context) *web.Error
- func ErrorText(code int) string
- func HandleError(w http.ResponseWriter, r *http.Request, err error)
- func HandleMiddlewareError(w http.ResponseWriter, r *http.Request, err error, next http.Handler)
- func Here() *errors.Frame
- func Is(err, target error) bool
- func New(s string, args ...interface{}) error
- func NewErrorFromResponse(res *http.Response) error
- func NewFromError(err error) error
- func NewWebError(code int, headers http.Header, body []byte) web.Error
- func NewWithStackTrace(skip int, s string, args ...interface{}) error
- func Recover() errors.Panic
- func StackFrame(skip int) *errors.Frame
- func StackTrace(err error) errors.Stack
- func Unwrap(err error) error
- func WithErrorContext(ctx context.Context, out *web.Error) context.Context
- func Wrap(err error, s string, args ...interface{}) error
- type BadRequestError
- type Frame
- type HandlerError
- func (err HandlerError) Error() string
- func (err HandlerError) Headers() http.Header
- func (err HandlerError) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (err HandlerError) Status() int
- func (err HandlerError) String() string
- func (err HandlerError) TryServeHTTP(w http.ResponseWriter, r *http.Request) error
- func (err HandlerError) Unwrap() error
- type MethodNotAllowedError
- func (err *MethodNotAllowedError) Error() string
- func (err *MethodNotAllowedError) Methods() []string
- func (err *MethodNotAllowedError) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (err *MethodNotAllowedError) Status() int
- func (err *MethodNotAllowedError) TryServeHTTP(w http.ResponseWriter, r *http.Request) error
- type NotAcceptableError
- type Panic
- type PanicError
- type RedirectError
- func AsRedirect(err error) (*RedirectError, bool)
- func NewFound(location string, args ...interface{}) *RedirectError
- func NewMovedPermanently(location string, args ...interface{}) *RedirectError
- func NewPermanentRedirect(location string, args ...interface{}) *RedirectError
- func NewSeeOther(location string, args ...interface{}) *RedirectError
- func NewTemporaryRedirect(location string, args ...interface{}) *RedirectError
- func (e RedirectError) Error() string
- func (e RedirectError) Location() string
- func (e *RedirectError) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (e RedirectError) Status() int
- func (e RedirectError) Temporary() bool
- func (e *RedirectError) TryServeHTTP(w http.ResponseWriter, r *http.Request) error
- type Stack
- type Validator
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // Constant http.StatusBadRequest HandlerError ErrBadRequest = &HandlerError{Code: http.StatusBadRequest} // Constant http.StatusNotAcceptable HandlerError ErrNotAcceptable = &HandlerError{Code: http.StatusNotAcceptable} )
View Source
var ( // 404 ErrNotFound = &HandlerError{Code: http.StatusNotFound} )
View Source
var (
ErrorCtxKey = context.NewContextKey("WebErrorContext")
)
Functions ¶
func AsInvalidArgumentError ¶ added in v0.36.0
func AsInvalidValueError ¶ added in v0.36.0
func AsMissingFieldError ¶ added in v0.36.0
func AsNotImplementedError ¶ added in v0.36.0
func AsValidator ¶ added in v0.27.1
errors.Validator
func AsWebError ¶ added in v0.26.0
func CodeIsRedirect ¶ added in v0.21.0
func ErrInvalidArgument ¶ added in v0.36.0
func ErrInvalidValue ¶ added in v0.33.0
func ErrMissingField ¶ added in v0.36.0
func ErrNotImplemented ¶ added in v0.35.0
func HandleError ¶
func HandleError(w http.ResponseWriter, r *http.Request, err error)
func HandleMiddlewareError ¶ added in v0.2.0
func NewErrorFromResponse ¶ added in v0.36.0
func NewFromError ¶ added in v0.19.3
Returns http.Handler capable web.Error
func NewWebError ¶ added in v0.26.0
func NewWithStackTrace ¶ added in v0.33.0
func StackFrame ¶ added in v0.22.1
func StackTrace ¶ added in v0.22.1
func WithErrorContext ¶ added in v0.26.0
Types ¶
type BadRequestError ¶ added in v0.6.0
type BadRequestError struct {
errors.ErrorStack
}
func BadRequest ¶ added in v0.40.0
func BadRequest(errs ...error) *BadRequestError
func (*BadRequestError) AsError ¶ added in v0.36.2
func (err *BadRequestError) AsError() error
func (*BadRequestError) ServeHTTP ¶ added in v0.6.0
func (err *BadRequestError) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*BadRequestError) Status ¶ added in v0.6.0
func (err *BadRequestError) Status() int
func (*BadRequestError) TryServeHTTP ¶ added in v0.37.0
func (err *BadRequestError) TryServeHTTP(w http.ResponseWriter, r *http.Request) error
type HandlerError ¶
Reference Handler error
func (HandlerError) Error ¶
func (err HandlerError) Error() string
func (HandlerError) Headers ¶ added in v0.18.0
func (err HandlerError) Headers() http.Header
func (HandlerError) ServeHTTP ¶
func (err HandlerError) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (HandlerError) Status ¶
func (err HandlerError) Status() int
func (HandlerError) String ¶
func (err HandlerError) String() string
func (HandlerError) TryServeHTTP ¶ added in v0.19.4
func (err HandlerError) TryServeHTTP(w http.ResponseWriter, r *http.Request) error
func (HandlerError) Unwrap ¶
func (err HandlerError) Unwrap() error
type MethodNotAllowedError ¶ added in v0.3.0
func MethodNotAllowed ¶
func MethodNotAllowed(method string, allowed ...string) *MethodNotAllowedError
func (*MethodNotAllowedError) Error ¶ added in v0.3.0
func (err *MethodNotAllowedError) Error() string
func (*MethodNotAllowedError) Methods ¶ added in v0.33.0
func (err *MethodNotAllowedError) Methods() []string
func (*MethodNotAllowedError) ServeHTTP ¶ added in v0.3.0
func (err *MethodNotAllowedError) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*MethodNotAllowedError) Status ¶ added in v0.3.0
func (err *MethodNotAllowedError) Status() int
func (*MethodNotAllowedError) TryServeHTTP ¶ added in v0.19.0
func (err *MethodNotAllowedError) TryServeHTTP(w http.ResponseWriter, r *http.Request) error
type NotAcceptableError ¶ added in v0.37.0
type NotAcceptableError struct {
errors.ErrorStack
}
func NotAcceptable ¶ added in v0.40.0
func NotAcceptable(errs ...error) *NotAcceptableError
func (*NotAcceptableError) AsError ¶ added in v0.37.0
func (err *NotAcceptableError) AsError() error
func (*NotAcceptableError) ServeHTTP ¶ added in v0.37.0
func (err *NotAcceptableError) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (*NotAcceptableError) Status ¶ added in v0.37.0
func (err *NotAcceptableError) Status() int
func (*NotAcceptableError) TryServeHTTP ¶ added in v0.37.0
func (err *NotAcceptableError) TryServeHTTP(w http.ResponseWriter, r *http.Request) error
type PanicError ¶ added in v0.3.0
func (PanicError) ServeHTTP ¶ added in v0.3.0
func (p PanicError) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (PanicError) Status ¶ added in v0.3.0
func (_ PanicError) Status() int
type RedirectError ¶ added in v0.15.0
type RedirectError struct {
// contains filtered or unexported fields
}
func AsRedirect ¶ added in v0.21.0
func AsRedirect(err error) (*RedirectError, bool)
Attempts to convert a given error into a RedirectError
func NewFound ¶ added in v0.15.0
func NewFound(location string, args ...interface{}) *RedirectError
302
func NewMovedPermanently ¶ added in v0.15.0
func NewMovedPermanently(location string, args ...interface{}) *RedirectError
301
func NewPermanentRedirect ¶ added in v0.15.0
func NewPermanentRedirect(location string, args ...interface{}) *RedirectError
308
func NewSeeOther ¶ added in v0.15.0
func NewSeeOther(location string, args ...interface{}) *RedirectError
303
func NewTemporaryRedirect ¶ added in v0.15.0
func NewTemporaryRedirect(location string, args ...interface{}) *RedirectError
307
func (RedirectError) Error ¶ added in v0.15.0
func (e RedirectError) Error() string
func (RedirectError) Location ¶ added in v0.15.0
func (e RedirectError) Location() string
func (*RedirectError) ServeHTTP ¶ added in v0.15.0
func (e *RedirectError) ServeHTTP(w http.ResponseWriter, r *http.Request)
func (RedirectError) Status ¶ added in v0.15.0
func (e RedirectError) Status() int
func (RedirectError) Temporary ¶ added in v0.15.0
func (e RedirectError) Temporary() bool
func (*RedirectError) TryServeHTTP ¶ added in v0.15.0
func (e *RedirectError) TryServeHTTP(w http.ResponseWriter, r *http.Request) error
Click to show internal directories.
Click to hide internal directories.