Documentation ¶
Index ¶
- Variables
- func ChainMiddlewares(handler http.Handler, middlewares ...Middleware) http.Handler
- func ConcatError(errs []error) error
- func IsNil(i any) bool
- func SafeParseDuration(name string, value string, defaultDuration time.Duration) time.Duration
- func WrapError(err, wrapper error) error
- func WrapForbidden(err error) error
- func WrapInternal(err error) error
- func WrapInvalid(err error) error
- func WrapMethodNotAllowed(err error) error
- func WrapNotFound(err error) error
- func WrapUnauthorized(err error) error
- type Middleware
- type Pinger
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrInvalid occurs when checks fails ErrInvalid = errors.New("invalid") ErrUnauthorized = errors.New("unauthorized") // ErrForbidden occurs when authorization header is missing ErrForbidden = errors.New("forbidden") // ErrNotFound occurs when something is not found ErrNotFound = errors.New("not found") // ErrMethodNotAllowed occurs when method is not allowed ErrMethodNotAllowed = errors.New("method not allowed") // ErrInternalError occurs when shit happens ErrInternalError = errors.New("internal error") )
Functions ¶
func ChainMiddlewares ¶
func ChainMiddlewares(handler http.Handler, middlewares ...Middleware) http.Handler
ChainMiddlewares chain middlewares call from last to first (so first item is the first called)
func ConcatError ¶
ConcatError concat errors to a single string
func SafeParseDuration ¶
SafeParseDuration parses given value into duration and fallback to a default value
func WrapForbidden ¶ added in v4.3.0
WrapForbidden wraps given error with forbidden err
func WrapInternal ¶
WrapInternal wraps given error with internal err
func WrapMethodNotAllowed ¶
WrapMethodNotAllowed wraps given error with not method not allowed err
func WrapNotFound ¶
WrapNotFound wraps given error with not found err
func WrapUnauthorized ¶ added in v4.3.0
WrapUnauthorized wraps given error with unauthorized err
Types ¶
type Middleware ¶
Middleware describe a middleware in the net/http package form
Click to show internal directories.
Click to hide internal directories.