Skip to main content

custom_http_error

Function custom_http_error 

Source
pub fn custom_http_error(
    req: &GatewayRequest,
    err: GatewayError,
) -> GatewayResponse
Expand description

A custom HTTP error handler that returns JSON error responses.

This handler maps gRPC status codes to HTTP status codes and returns a JSON body with:

  • message: The error message.
  • status_code: The HTTP status code.
  • title: A title for the error (default “Error”).

It falls back to default_error_handler for 2xx codes or codes outside the valid HTTP range [200, 505].