pub async fn render_error_middleware(
__arg0: State<RenderErrorState>,
req: Request,
next: Next,
) -> Response<Body>Expand description
Middleware that styles error responses for ANY registered status code
(e.g. 429, 403, 410) the way render_500_middleware does for 500. After
the handler runs, if the response status has a registered template and the
body isn’t already HTML, the body text is captured as the message and the
template is rendered in its place — preserving the original status code.
Registered via App::builder().error_template(status, "name.html"). 404
and 500 keep their dedicated paths (not_found_template /
server_error_template); this covers everything else a handler returns as
Err((status, message)).