pub enum DocarooError {
RequestFailed(Error),
ApiError {
code: String,
message: String,
request_id: Option<String>,
},
InvalidRequest(String),
RateLimitExceeded {
retry_after: u64,
},
AuthenticationFailed(String),
ParseError(String),
UrlError(ParseError),
}
Expand description
Errors that can occur when interacting with the Docaroo API
Variants§
RequestFailed(Error)
HTTP request failed
ApiError
API returned an error response
Fields
InvalidRequest(String)
Invalid request parameters
RateLimitExceeded
Rate limit exceeded
AuthenticationFailed(String)
Authentication failed
ParseError(String)
Deserialization error
UrlError(ParseError)
URL parsing error
Implementations§
Source§impl DocarooError
impl DocarooError
Sourcepub fn from_error_response(response: ErrorResponse) -> Self
pub fn from_error_response(response: ErrorResponse) -> Self
Create an API error from an error response
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if this error is retryable
Sourcepub fn request_id(&self) -> Option<&str>
pub fn request_id(&self) -> Option<&str>
Get the request ID if available (for support purposes)
Trait Implementations§
Source§impl Debug for DocarooError
impl Debug for DocarooError
Source§impl Display for DocarooError
impl Display for DocarooError
Source§impl Error for DocarooError
impl Error for DocarooError
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()
Source§impl From<Error> for DocarooError
impl From<Error> for DocarooError
Source§impl From<ParseError> for DocarooError
impl From<ParseError> for DocarooError
Source§fn from(source: ParseError) -> Self
fn from(source: ParseError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for DocarooError
impl !RefUnwindSafe for DocarooError
impl Send for DocarooError
impl Sync for DocarooError
impl Unpin for DocarooError
impl !UnwindSafe for DocarooError
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<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string
, but without panic on OOM.