errors

package
v0.2.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 21, 2021 License: MIT Imports: 4 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound = &HandlerError{Code: http.StatusNotFound}
)

Functions

func ErrorText

func ErrorText(code int) string

func HandleError

func HandleError(w http.ResponseWriter, r *http.Request, err error)

func HandleMiddlewareError added in v0.2.0

func HandleMiddlewareError(w http.ResponseWriter, r *http.Request, err error, next http.Handler)

func MethodNotAllowed

func MethodNotAllowed(method string, allowed ...string) web.Error

Types

type ErrMethodNotAllowed

type ErrMethodNotAllowed struct {
	Method  string
	Allowed []string
}

func (*ErrMethodNotAllowed) Error

func (err *ErrMethodNotAllowed) Error() string

func (*ErrMethodNotAllowed) ServeHTTP

func (err *ErrMethodNotAllowed) ServeHTTP(w http.ResponseWriter, _ *http.Request)

func (*ErrMethodNotAllowed) Status

func (err *ErrMethodNotAllowed) Status() int

type HandlerError

type HandlerError struct {
	Code int
	Err  error
}

Reference Handler error

func (HandlerError) Error

func (err HandlerError) Error() string

func (HandlerError) ServeHTTP

func (err HandlerError) ServeHTTP(w http.ResponseWriter, _ *http.Request)

func (HandlerError) Status

func (err HandlerError) Status() int

func (HandlerError) String

func (err HandlerError) String() string

func (HandlerError) Unwrap

func (err HandlerError) Unwrap() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL