pub struct ErrorDetail {
pub error_type: Option<String>,
pub message: Option<String>,
pub request_id: Option<String>,
pub raw: String,
}Expand description
Information recovered from an unsuccessful API response body.
Use this for diagnostics without depending on one server error-body shape.
Self::raw always preserves the body even when structured parsing fails.
Fields§
§error_type: Option<String>Use this category for programmatic grouping when the API supplies it.
message: Option<String>Use this message in logs or user-facing diagnostics when present.
request_id: Option<String>Use this x-typesafe-request-id value when contacting API support.
raw: StringUse this lossily decoded body when structured fields are absent.
Implementations§
Source§impl ErrorDetail
impl ErrorDetail
Sourcepub fn parse(body: &[u8], request_id: Option<&str>) -> ErrorDetail
pub fn parse(body: &[u8], request_id: Option<&str>) -> ErrorDetail
Parses an unsuccessful response after its headers have been extracted.
let body = br#"{"detail":{"error_type":"api_usage_error","message":"Invalid request."}}"#;
let detail = jevrs_core::ErrorDetail::parse(body, Some("req_123"));
assert_eq!(detail.error_type.as_deref(), Some("api_usage_error"));
assert_eq!(detail.request_id.as_deref(), Some("req_123"));Trait Implementations§
Source§impl Debug for ErrorDetail
impl Debug for ErrorDetail
Source§impl Display for ErrorDetail
impl Display for ErrorDetail
impl Eq for ErrorDetail
Source§impl PartialEq for ErrorDetail
impl PartialEq for ErrorDetail
impl StructuralPartialEq for ErrorDetail
Auto Trait Implementations§
impl Forget for ErrorDetail
impl Freeze for ErrorDetail
impl Move for ErrorDetail
impl RefUnwindSafe for ErrorDetail
impl Send for ErrorDetail
impl Sync for ErrorDetail
impl Unpin for ErrorDetail
impl UnsafeUnpin for ErrorDetail
impl UnwindSafe for ErrorDetail
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.