Expand description
gRPC → HTTP error mapping.
Converts tonic::Status to appropriate HTTP status codes and JSON error bodies
following the gRPC-HTTP status code mapping from the gRPC specification, and
renders the typed google.rpc.Status details the upstream attached in the
grpc-status-details-bin trailer.
Structs§
- Error
Details Policy - Which routes return
detailsin their error bodies. - Status
Details - Renders the typed details of a gRPC status (
grpc-status-details-bin) as proto3 JSON.
Functions§
- error_
body - The JSON error body for a failed call, shared by the unary response and the terminal frame of a stream so a client parses one shape everywhere.
- grpc_
to_ http_ status - Map a gRPC status code to the corresponding HTTP status code.
- status_
to_ response - Convert a
tonic::Statusinto an axum HTTP response with a JSON error body{"error", "message", "code"}, without status details. - status_
to_ response_ with_ details - Convert a
tonic::Statusinto an axum HTTP response with a JSON error body.