Skip to main content

Module http_error_mapping

Module http_error_mapping 

Source
Expand description

Route-level mapping from business error payloads to HTTP statuses.

HttpErrorMapping is a route-level field, deliberately separate from crate::error_handler::ErrorHandlerConfig: the mapping decides the reply status of a propagated CamelError::Business, while the error handler owns retry/dead-letter policy. A route may carry both.

Status resolution precedence (see business_status):

  1. explicit codes entry (exact, case-sensitive match on the code),
  2. explicit kinds entry (exact, case-sensitive match on the kind),
  3. the built-in default kind map (default_kind_status),
  4. 500.

Values are restricted to the client/server error domain (400..=599). Load-time validation (validate_status, validate_key, and HttpErrorMapping::validate) rejects blank keys and out-of-domain values. Programmatic construction can bypass that validation, so resolution also defends: an out-of-domain entry is treated as absent and the remaining precedence rules apply. A business error can never resolve to a 2xx status.

Structs§

HttpErrorMapping
Route-level business error to HTTP status mapping.

Enums§

HttpErrorMappingError
Typed load-time validation failure for an HttpErrorMapping.
MappingTable
Which table of an HttpErrorMapping a key belongs to.

Constants§

DEFAULT_BUSINESS_STATUS
Status used when no mapping entry and no built-in default matches.
MAX_MAPPED_STATUS
Highest status an error mapping entry may produce (server error).
MIN_MAPPED_STATUS
Lowest status an error mapping entry may produce (client error).

Functions§

business_status
Resolve the reply status for a business error.
default_kind_status
Built-in default status for a business error kind, if the kind is mapped.
is_mapped_status
Returns true when status is a client or server error status (400..=599), the only domain a business error may map to.
validate_key
Reject a blank table key.
validate_status
Reject a status outside the client/server error domain.