pub struct ApiError {
pub status: u16,
pub kind: ApiErrorKind,
pub message: String,
pub body: Option<Value>,
pub headers: HeaderMap,
pub request_id: Option<String>,
pub endpoint: String,
pub retry_after: Option<Duration>,
}Expand description
A request failed because the HTTP response carried an error status.
The Display format is "<METHOD> <URL>: <status> <message> (request_id=<id>)",
with the request-ID suffix only when present.
Fields§
§status: u16HTTP response status code.
kind: ApiErrorKindThe status-derived error kind.
message: StringThe extracted or synthesized message (never the raw body over 200 chars).
body: Option<Value>The server’s JSON error body when parseable, the raw text otherwise,
and None when the body was empty.
headers: HeaderMapResponse headers (the API key is never present in responses).
request_id: Option<String>x-typesafe-request-id response header value, when present.
endpoint: String"<METHOD> <URL>" of the request, without query parameters.
retry_after: Option<Duration>Parsed retry-after-ms / Retry-After delay, when present.
Trait Implementations§
Source§impl Error for ApiError
impl Error for ApiError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for ApiError
impl RefUnwindSafe for ApiError
impl Send for ApiError
impl Sync for ApiError
impl Unpin for ApiError
impl UnsafeUnpin for ApiError
impl UnwindSafe for ApiError
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