pub enum Error {
BadRequest {
body: String,
},
Unauthorized {
body: String,
},
Forbidden {
body: String,
},
TooManyRequests {
body: String,
},
ServiceUnavailable {
body: String,
},
UnexpectedStatus {
status: u16,
body: String,
},
Transport(Error),
Decode {
source: Error,
body: String,
},
Auth(AuthError),
InvalidHeader(String),
EncodeForm(String),
}Expand description
All recoverable failures from the Nordnet API client.
Variants§
BadRequest
HTTP 400 — invalid parameter per docs.
HTTP 401 — unauthorized (typically rejected credentials).
Fields
Forbidden
HTTP 403 — forbidden.
TooManyRequests
HTTP 429 — Too Many Requests. The library does not retry; the caller chooses whether to back off and re-issue.
HTTP 503 — Service Unavailable. The library does not retry; the
caller chooses whether to back off and re-issue (and is responsible
for honoring Retry-After if present in the underlying response).
UnexpectedStatus
Any non-2xx response not specifically modelled above.
Transport(Error)
Underlying reqwest transport failure (DNS, connect, TLS, timeout, …).
Decode
Response body was not valid JSON for the expected type.
Auth(AuthError)
Failure during the SSH-key login flow (key parsing, algorithm
mismatch, encrypted-key rejection, …). The wrapped
nordnet_model::AuthError carries the specific failure mode.
InvalidHeader(String)
Header value construction failed (typically because credentials contain bytes that are not valid for an HTTP header).
EncodeForm(String)
Form-urlencoded serialization failed (used by Client::post_form
and Client::put_form for endpoints whose Swagger 2.0 parameters
are marked FormData).
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)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl !UnwindSafe 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
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.