pub struct ApiError {
pub code: String,
pub description: String,
pub field: Option<String>,
pub error_source: Option<String>,
pub step: Option<String>,
pub reason: Option<String>,
pub http_status: StatusCode,
}Expand description
A structured error returned by Razorpay.
All six documented fields are preserved: collapsing them into a single string
loses reason and step, which are exactly the fields that explain why a
payment declined.
Fields§
§code: StringMachine-readable code, e.g. BAD_REQUEST_ERROR.
Match on this rather than description, which
Razorpay may reword without notice.
description: StringHuman-readable message. Do not match on this text.
field: Option<String>Which request field was at fault, when applicable.
error_source: Option<String>Which side caused the failure, e.g. business, customer.
Razorpay names this source on the wire; it is renamed here to avoid
colliding with std::error::Error::source.
step: Option<String>Which step of the flow failed, e.g. payment_initiation.
reason: Option<String>Failure reason, e.g. input_validation_failed.
http_status: StatusCodeThe HTTP status carried alongside the error.
Needed for retry decisions: code is often the generic BAD_REQUEST_ERROR
for both a 400 and a 404. Defaulted because it comes from the response, not
the JSON body.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ApiError
impl<'de> Deserialize<'de> for ApiError
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>,
impl Eq for ApiError
impl StructuralPartialEq for ApiError
Auto Trait Implementations§
impl Freeze for ApiError
impl RefUnwindSafe for ApiError
impl Send for ApiError
impl Sync for ApiError
impl Unpin for ApiError
impl UnsafeUnpin for ApiError
impl UnwindSafe for ApiError
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.