Skip to main content

error_handler

Attribute Macro error_handler 

Source
#[error_handler]
Expand description

Registers a sync function as the application-wide custom error handler.

The function must be sync (not async) and must have exactly two parameters: (modo::Error, &modo::ErrorContext). It must return axum::response::Response.

Only one error handler may be registered per binary. The handler receives every modo::Error that propagates out of a route and can inspect the request context (method, URI, headers) to produce a suitable response.