Skip to main content

status_to_response_with_details

Function status_to_response_with_details 

Source
pub fn status_to_response_with_details(
    status: &Status,
    details: Option<&StatusDetails>,
) -> Response
Expand description

Convert a tonic::Status into an axum HTTP response with a JSON error body.

The body is {"error", "message", "code"}, plus a details array when details is given (see error_body). The HTTP status follows the code the body reports, so a malformed upstream status answers 500.