If an exception of the term error(Formal, context(Stack,
Context))
is caught and subsumes_term(ContextTemplate, Context)
is true, translate the exception into an HTTP 400 exception. If
the exception contains a stack-trace, this is stripped from the
response.
The idea behind this hook is that applications can raise 400
responses by
- Throwing a specific (error) exception and adding a rule
to this predicate to interpret this as 400.
- Define rules for error_message//1 to formulate
an appropriate message.