Skip to main content

map_http_error

Function map_http_error 

Source
pub fn map_http_error(
    status: u16,
    body: String,
    retry_after: Option<Duration>,
) -> TransportError
Expand description

Map a non-success HTTP response into a TransportError.

Tries to parse the body as an RFC 9457 Problem envelope first, falling back to TransportError::HttpStatus with a truncated body excerpt for peers that don’t speak the canonical-errors envelope.

retry_after is the parsed Retry-After header (see parse_retry_after); it is attached to both the TransportError::Problem and the TransportError::HttpStatus fallback so the retry loop honors a server-advised backoff regardless of whether the peer speaks canonical errors.