pub enum ErrorBody {
Trader(ServiceError),
MarketData(ErrorResponse),
Unrecognized(String),
}Expand description
A decoded non-2xx response body.
Schwab’s Trader and Market Data APIs return structurally different error envelopes; this preserves whichever shape arrived.
§Examples
use schwab_sdk::{Error, ErrorBody};
match err {
Error::Http { status, body, .. } => match body {
ErrorBody::Trader(svc) => eprintln!("{status}: {}", svc.message),
ErrorBody::MarketData(resp) => eprintln!("{status}: {resp}"),
ErrorBody::Unrecognized(raw) => eprintln!("{status}: {raw}"),
},
other => eprintln!("{other}"),
}Variants§
Trader(ServiceError)
Trader API shape: a top-level message plus error strings.
MarketData(ErrorResponse)
Market Data API shape: a list of structured errors.
Unrecognized(String)
The body matched neither family’s schema; the raw text is kept for diagnostics.
Trait Implementations§
impl Eq for ErrorBody
impl StructuralPartialEq for ErrorBody
Auto Trait Implementations§
impl Freeze for ErrorBody
impl RefUnwindSafe for ErrorBody
impl Send for ErrorBody
impl Sync for ErrorBody
impl Unpin for ErrorBody
impl UnsafeUnpin for ErrorBody
impl UnwindSafe for ErrorBody
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.