Skip to main content

convert_handler_error_response

Function convert_handler_error_response 

Source
pub async fn convert_handler_error_response<C>(
    response: Response<Body>,
    codec: &C,
    headers: &HeaderMap,
) -> Response<Body>
where C: HttpTransport,
Expand description

Post-process a handler-emitted response. Success responses pass through unchanged. Non-2xx responses are buffered, their bodies decoded as cratestack_core::CoolErrorResponse (the REST shape the existing axum handlers emit), translated to RpcErrorBody with the gRPC-style code, and re-encoded with the same HTTP status.

Called once per dispatch (inside rpc_dispatch_inner) so unary and batch both see uniformly RpcErrorBody-shaped error bodies.