#[non_exhaustive]pub enum RestError {
Transport {
source: TransportError,
},
HttpStatus {
endpoint: &'static str,
status: StatusCode,
body: String,
},
Okx {
endpoint: &'static str,
code: String,
message: String,
},
Decode {
endpoint: &'static str,
source: Error,
},
Encode {
source: Box<dyn Error + Send + Sync>,
},
Configuration(String),
}Expand description
Errors from the REST API layer.
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
The underlying HTTP transport failed (connection, TLS, timeout, …).
Fields
§
source: TransportErrorFinding the position of the error
HttpStatus
The HTTP response had a non-success status before the OKX envelope could be decoded.
Fields
§
status: StatusCodeHTTP response status code.
Okx
OKX returned a non-zero response code.
Fields
Decode
The response body could not be decoded into the expected model.
Encode
The request could not be encoded (query string, JSON body, or headers).
Configuration(String)
The client was used in an invalid way (e.g. an authenticated endpoint was called without credentials).
Trait Implementations§
Source§impl Error for RestError
impl Error for RestError
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<TransportError> for RestError
impl From<TransportError> for RestError
Source§fn from(source: TransportError) -> Self
fn from(source: TransportError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for RestError
impl !UnwindSafe for RestError
impl Freeze for RestError
impl Send for RestError
impl Sync for RestError
impl Unpin for RestError
impl UnsafeUnpin for RestError
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