Documentation
¶
Index ¶
- func DefaultErrorHandler(err interface{}, w http.ResponseWriter, r *http.Request)
- func HandleError(err interface{}, w http.ResponseWriter, r *http.Request, opts ...Option)
- func HandleRecover(w http.ResponseWriter, r *http.Request, opts ...Option)
- func Handler(h http.Handler, opts ...Option) http.Handler
- func PrintError(err interface{}, out io.Writer) error
- func ServeHTTP(w http.ResponseWriter, r *http.Request, next http.HandlerFunc, opts ...Option)
- func SetDefaultOptions(opts ...Option)
- type ErrorHandler
- type HandlerFunc
- type Option
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultErrorHandler ¶
func DefaultErrorHandler(err interface{}, w http.ResponseWriter, r *http.Request)
DefaultErrorHandler is an handler provided by letitcrash to render the error.
func HandleError ¶
func HandleError(err interface{}, w http.ResponseWriter, r *http.Request, opts ...Option)
HandleError handles an error.
func HandleRecover ¶
func HandleRecover(w http.ResponseWriter, r *http.Request, opts ...Option)
HandleRecover handles an error from a recover situation.
func PrintError ¶
PrintError handles error and format it to stdout.
func ServeHTTP ¶
func ServeHTTP(w http.ResponseWriter, r *http.Request, next http.HandlerFunc, opts ...Option)
ServeHTTP is a Negroni compatible interface.
func SetDefaultOptions ¶
func SetDefaultOptions(opts ...Option)
SetDefaultOptions sets default options.
Types ¶
type ErrorHandler ¶
type ErrorHandler func(err interface{}, w http.ResponseWriter, r *http.Request)
ErrorHandler is an handler to render the error.
type HandlerFunc ¶
type HandlerFunc func(http.ResponseWriter, *http.Request) error
HandlerFunc is a http.HandlerFunc which can return an error.
func (HandlerFunc) ServeHTTP ¶
func (f HandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP calls f(w, r).
type Option ¶
type Option func(*Options)
Option is a functional option.
func WithErrorHandler ¶
func WithErrorHandler(errorHandler ErrorHandler) Option
WithErrorHandler sets the error handler option.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.