calternal_api::http_failure
Typed HTTP failures shared by client surfaces (#835, DESIGN §41). Preserve the existing error envelope and Retry-After value. This adds client metadata without changing server responses or requiring problem+json.
Source: crates/calternal-api/src/http_failure.rs
Structs
Section titled “Structs”HttpFailure
Section titled “HttpFailure”pub struct HttpFailureAn HTTP status and its safe server error object. Unknown codes and detail fields survive unchanged so an older client can classify a newer response.
Fields
pub status: u16pub error: Valuepub payload: Value: Preserve typed non-envelope failures and any extra root fields (#835).pub retry_after: Option<String>
Implements: Debug, Clone, Deserialize, Serialize, std::fmt::Display, std::error::Error
HttpFailure::from_parts
Section titled “HttpFailure::from_parts”pub fn from_parts(status: u16, body: &[u8], retry_after: Option<String>) -> SelfParse a bounded response body; malformed gateway HTML is never echoed. An absent error object keeps the legacy status-only human message.
HttpFailure::with_display_text
Section titled “HttpFailure::with_display_text”pub fn with_display_text(mut self, text: String) -> SelfKeep a client’s existing human diagnostic while typed fields stay intact (#835).
HttpFailure::with_status_label
Section titled “HttpFailure::with_status_label”pub fn with_status_label(self, status: &str) -> SelfKeep a transport’s canonical status wording without duplicating its formatter (#835).
HttpFailure::message
Section titled “HttpFailure::message”pub fn message(&self) -> Option<&str>Return the server’s error message while keeping code/details as data.
Source: crates/calternal-api/src/http_failure.rs:14
Constants
Section titled “Constants”MAX_HTTP_ERROR_BODY_BYTES
Section titled “MAX_HTTP_ERROR_BODY_BYTES”pub const MAX_HTTP_ERROR_BODY_BYTES: usizeShare the client failure-body budget across HTTP library versions (#835).