Skip to main content

v2_error_envelope

Function v2_error_envelope 

Source
pub(crate) async fn v2_error_envelope(req: Request, next: Next) -> Response
Expand description

Give framework-level rejections on the v2 routes the same error envelope as handler errors.

The generated handlers extract with Query<T>, and axum answers a rejected query string itself, with a text/plain body that never reaches tonic_rest::RestError. protoJSON decoding rejects unknown fields, so that is the most likely client mistake on these routes, and API.md promises one error shape for all of them. Rebuilding the rejection as a [tonic::Status] reuses tonic-rest’s envelope instead of hand-rolling a second copy.