#[non_exhaustive]pub struct ProviderError {
pub code: i32,
pub name: Option<&'static str>,
pub order_id: Option<OrderId>,
/* private fields */
}Expand description
A provider-declared failed operation.
The provider names every code it publishes, and the same number means
different things to different endpoints: code 2 is OrderRejected for
/api/Order/place and OrderNotFound for /api/Order/cancel. Self::name
carries the published text for the endpoint that produced the rejection.
The provider’s free-form errorMessage is available only through
Self::untrusted_message. It never appears in this error’s Display
output, and Debug output shows only whether a message is present.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.code: i32Provider error code.
name: Option<&'static str>Provider-published name for Self::code, when the endpoint’s
published error-code table defines it.
Undocumented codes, including codes the provider adds after this crate
was published, are None.
order_id: Option<OrderId>Order record the provider created for a rejected placement, when it returned one.
Only Client::place_order reads this
field; every other operation reports None. The record exists on the
provider but was not accepted, so it never implies a working order.
Implementations§
Source§impl ProviderError
impl ProviderError
Sourcepub fn untrusted_message(&self) -> Option<&str>
pub fn untrusted_message(&self) -> Option<&str>
Returns the provider’s free-form errorMessage, when it sent one.
The text is untrusted remote input, passed through exactly as the
provider sent it: it may contain control characters, terminal escape
sequences, markup, line breaks, or account details, and its length is
bounded only by the client’s configured response-size limit. Clean or
escape it before displaying or logging it. It is None when the
provider sent null or omitted the field. Decide the outcome from
Self::code, never from this text.
Trait Implementations§
Source§impl Clone for ProviderError
impl Clone for ProviderError
Source§impl Debug for ProviderError
impl Debug for ProviderError
Source§impl Display for ProviderError
impl Display for ProviderError
impl Eq for ProviderError
Source§impl Error for ProviderError
impl Error for ProviderError
1.30.0 · 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()