Documentation ¶
Overview ¶
Package web implements a middleware to handle HTTP errors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrorMiddleware ¶
func ErrorMiddleware(extraRenderers map[string]ErrorRenderer) echo.MiddlewareFunc
ErrorMiddleware returns an Echo middleware that catches errors in the chain, and renders them using the negotiated renderer. Global renderers can be registered with RegisterRenderer, and extra renderers can be passed to this function.
func ProcessError ¶
ProcessError processes an HTTP error by converting it if appropriate, and determining the HTTP status code to return.
func RegisterRenderer ¶
func RegisterRenderer(contentType string, renderer ErrorRenderer)
RegisterRenderer registers a global error renderer.
Types ¶
type ErrorRenderer ¶
ErrorRenderer is an interface for rendering errors to HTTP responses.
type ErrorRendererFunc ¶
ErrorRendererFunc is a function signature that implements ErrorRenderer.
func (ErrorRendererFunc) RenderError ¶
RenderError implements the ErrorRenderer interface.