Oaskit.ErrorHandler.Default (oaskit v0.1.0)
View SourceThe default error handler for validation errors.
Returns various HTTP error codes depending on the validation failure:
422Unprocessable Entity - When JSON schema errors when validating request bodies.415Unsupported Media Type - When matching the request content-type to the accepted content-types.400Bad Request - When validating query and path parameters.
Error formatting
For request specifically accepting HTML ("html" is found in the Accept
header), this handler will present errors in an HTML document with basic
styles.
In any other case, a JSON representation of errors is returned with the
"application/json" content type.
Disable HTML entirely with the html_errors: false option when using the
Oaskit.Plugs.ValidateRequest plug.
Summary
Functions
Callback implementation for Oaskit.ErrorHandler.handle_error/3.
Functions
Callback implementation for Oaskit.ErrorHandler.handle_error/3.