pub struct ApiErrorResponse {
pub details: Option<Value>,
pub message: String,
pub status: u16,
}Expand description
Structured API error response matching Bullet API format.
All error responses from the trading API conform to this schema.
JSON schema
{
"description": "Structured API error response matching Bullet API format.\n\nAll error responses from the trading API conform to this schema.",
"type": "object",
"required": [
"message",
"status"
],
"properties": {
"details": {
"description": "Optional structured error details."
},
"message": {
"description": "Human-readable error message.",
"examples": [
"Transaction validation failed: insufficient funds"
],
"type": "string"
},
"status": {
"description": "HTTP status code.",
"examples": [
400
],
"type": "integer",
"format": "uint16",
"minimum": 0.0
}
}
}Fields§
§details: Option<Value>Optional structured error details.
message: StringHuman-readable error message.
status: u16HTTP status code.
Implementations§
Source§impl ApiErrorResponse
impl ApiErrorResponse
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Whether this error is potentially transient and the operation could be retried with backoff.
Sourcepub fn is_status_unknown(&self) -> bool
pub fn is_status_unknown(&self) -> bool
Whether the HTTP status code was lost during error conversion.
This happens when the server returns a non-JSON body (e.g. HTML from a
load balancer) that progenitor can’t deserialize. The raw body is
preserved in message, but the status code is unavailable.
Callers may want to treat these as retryable (usually transient proxy
errors) but should be aware that a 4xx with a non-JSON body would also
produce status == 0.
Trait Implementations§
Source§impl Clone for ApiErrorResponse
impl Clone for ApiErrorResponse
Source§fn clone(&self) -> ApiErrorResponse
fn clone(&self) -> ApiErrorResponse
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ApiErrorResponse
impl Debug for ApiErrorResponse
Source§impl<'de> Deserialize<'de> for ApiErrorResponse
impl<'de> Deserialize<'de> for ApiErrorResponse
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for ApiErrorResponse
impl Display for ApiErrorResponse
Auto Trait Implementations§
impl Freeze for ApiErrorResponse
impl RefUnwindSafe for ApiErrorResponse
impl Send for ApiErrorResponse
impl Sync for ApiErrorResponse
impl Unpin for ApiErrorResponse
impl UnsafeUnpin for ApiErrorResponse
impl UnwindSafe for ApiErrorResponse
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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.