#[non_exhaustive]pub enum Error {
Transport(Error),
Api {
status: u16,
code: Option<u32>,
message: String,
},
Deserialize(Error),
InvalidInput(String),
RateLimited {
retry_after: Option<Duration>,
},
}Expand description
Errors returned by the ferric-fred client.
The library never panics on a network or parse failure — those surface here
as Err. The enum is #[non_exhaustive] so new variants can be added
without a breaking change (see ADR-0004).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Transport(Error)
A connection, timeout, or TLS-level failure from the HTTP transport.
Api
FRED returned an error payload. FRED encodes errors in the response body with a code and message alongside the HTTP status.
Fields
Deserialize(Error)
A response body did not match the expected shape.
InvalidInput(String)
Caller-side validation failed before any request was made.
RateLimited
FRED rate-limited the request. Surfaced distinctly so callers can back off.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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 !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Freeze for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
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