pub struct ApiError(/* private fields */);Expand description
An error answered by the API.
For REST it carries the HTTP status and the problem body. A refused WebSocket dial
carries the dial status. A connection.error frame carries status 0 and the frame’s code.
Implementations§
Source§impl ApiError
impl ApiError
Sourcepub fn status(&self) -> u16
pub fn status(&self) -> u16
HTTP status (0 for a connection.error frame, 1008 for a policy close).
Sourcepub fn code(&self) -> Option<&ProblemCode>
pub fn code(&self) -> Option<&ProblemCode>
Problem code (open), None when the body had none.
Sourcepub fn type(&self) -> Option<&str>
pub fn type(&self) -> Option<&str>
Problem type URL, e.g. https://docs.finlight.me/errors/not-found.
Sourcepub fn request_id(&self) -> Option<&str>
pub fn request_id(&self) -> Option<&str>
Request id: the server’s value, else the X-Request-Id the SDK sent.
Sourcepub fn errors(&self) -> &[FieldIssue]
pub fn errors(&self) -> &[FieldIssue]
Field problems of validation and cursor errors.
Sourcepub fn api_kind(&self) -> ApiErrorKind
pub fn api_kind(&self) -> ApiErrorKind
Kind of the error.
Sourcepub fn limit_type(&self) -> Option<&RateLimitType>
pub fn limit_type(&self) -> Option<&RateLimitType>
For 429: which limit was hit (monthly, burst, unknown or the value the server sent).
Sourcepub fn retry_after(&self) -> Option<Duration>
pub fn retry_after(&self) -> Option<Duration>
For 429: the Retry-After header, when the server sent one.
Sourcepub fn raw_json(&self) -> Option<&str>
pub fn raw_json(&self) -> Option<&str>
The body as JSON text (same as ApiError::raw).
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 Forget for ApiError
impl Freeze for ApiError
impl Move for ApiError
impl RefUnwindSafe for ApiError
impl Send for ApiErrorwhere
BoxRaw<ApiErrorData>: Send,
impl Sync for ApiErrorwhere
BoxRaw<ApiErrorData>: Sync,
impl Unpin for ApiError
impl UnsafeUnpin for ApiError
impl UnwindSafe for ApiErrorwhere
BoxRaw<ApiErrorData>: UnwindSafe,
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