var ( // RecoverStackDepth is the max depth of stack trace to recover on panic. RecoverStackDepth = 32 )
func Get(r *http.Request) error
Get retrieves an error from the request's context. It returns nil if the request was not configured to store errors.
func Store(r *http.Request, err error)
Store stores an error into the request's context. It panics if the request was not configured to store errors.
func Try(h Handler) http.Handler
Try converts a handler to a standard http.Handler, storing any error in the request's context.
func TryFunc(h func(http.ResponseWriter, *http.Request) error) http.Handler
TryFunc converts a handler function to a standard http.Handler, storing any error in the request's context.
Handler is a variant on http.Handler that can return an error.
type Handler interface { ServeHTTP(w http.ResponseWriter, r *http.Request) error }
HandlerFunc is a variant on http.HandlerFunc that can return an error.
type HandlerFunc func(w http.ResponseWriter, r *http.Request) error
func (f HandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request) error
Middleware adds additional functionality to an existing handler.
type Middleware func(http.Handler) http.Handler
func Catch(h func(w http.ResponseWriter, r *http.Request, err error)) Middleware
Catch creates middleware that processes errors stored while serving a request. Errors are passed to the callback, which should write them to the response in an appropriate format. This is usually the outermost middleware in a chain.
func Recover() Middleware
Recover creates middleware that can recover from a panic in a handler, storing a PanicError for future handling.
PanicError is an Error created from a recovered panic.
type PanicError struct {
// contains filtered or unexported fields
}
func (e PanicError) Error() string
func (e PanicError) Format(s fmt.State, verb rune)
Format formats the error optionally including the stack trace.
%s the error message %v the error message and the source file and line number for each stack frame
Format accepts the following flags:
%+v the error message, and the function, file, and line for each stack frame
func (e PanicError) StackTrace() []runtime.Frame
StackTrace returns the stack of the panicking goroutine.
func (e PanicError) Value() interface{}
Value returns the exact value with which panic() was called.