#[non_exhaustive]pub struct ApiErrorBody {
pub error_message: String,
pub error_code: Option<String>,
pub reject_reason: Option<String>,
pub extra: Map<String, Value>,
}Expand description
The JSON body OANDA returns for error responses.
All error responses carry errorMessage; some also carry errorCode
and/or rejectReason. Order-related rejections include additional
top-level fields (e.g. orderRejectTransaction, relatedTransactionIDs,
lastTransactionID), which are preserved in ApiErrorBody::extra and
can be decoded into a typed struct with ApiErrorBody::details.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.error_message: StringHuman-readable description of the error.
error_code: Option<String>Machine-readable error code, when provided.
reject_reason: Option<String>The reason the request was rejected, when provided.
extra: Map<String, Value>Any additional top-level fields of the error body.
Implementations§
Source§impl ApiErrorBody
impl ApiErrorBody
Sourcepub fn details<T: DeserializeOwned>(&self) -> Option<T>
pub fn details<T: DeserializeOwned>(&self) -> Option<T>
Attempts to decode the full error body into a typed view.
Useful for order endpoints, whose 400/404 responses carry reject
transactions, e.g.
CreateOrderRejectBody.
Trait Implementations§
Source§impl Clone for ApiErrorBody
impl Clone for ApiErrorBody
Source§fn clone(&self) -> ApiErrorBody
fn clone(&self) -> ApiErrorBody
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ApiErrorBody
impl Debug for ApiErrorBody
Source§impl<'de> Deserialize<'de> for ApiErrorBody
impl<'de> Deserialize<'de> for ApiErrorBody
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ApiErrorBody
impl RefUnwindSafe for ApiErrorBody
impl Send for ApiErrorBody
impl Sync for ApiErrorBody
impl Unpin for ApiErrorBody
impl UnsafeUnpin for ApiErrorBody
impl UnwindSafe for ApiErrorBody
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