Skip to main content

into_error_response

Function into_error_response 

Source
pub fn into_error_response(err: &impl ApiError) -> Response
Expand description

Convert any ApiError into an axum Response.

Produces a JSON body of the form:

{"error": {"code": "ERROR_CODE", "message": "human-readable message"}}

For rate-limited responses (when retry_after_secs() returns Some), includes the Retry-After header per RFC 6585.