Expand description
§Errors
§Purpose
Defines the domain-specific error types for the gateway and utilities for mapping gRPC status codes to HTTP status codes. This module ensures that internal errors and upstream gRPC errors are correctly translated into HTTP responses.
§Scope
This module defines:
GatewayError: The primary error type representing failures within the gateway or upstream interactions.map_code_to_status: A utility to convert gRPCCodes to HTTPStatusCodes.handle_error: A utility to construct a JSON error response from atonic::Status.
§Position in the Architecture
Errors originating from the codec, router, or upstream gRPC calls are captured as GatewayError.
The generated code uses handle_error to transform these errors into standard HTTP responses
before sending them to the client.
§Design Constraints
- Dual-Mode Error Handling: When
stdis enabled, it leveragesthiserrorfor ergonomic error definition. Inno_stdenvironments, it falls back to a manual implementation usingalloc.
Enums§
- Gateway
Error - Domain-specific errors for the gateway.
Functions§
- handle_
error - Converts a gRPC status into an HTTP response.
- map_
code_ to_ status - Maps a gRPC status code to an HTTP status code.