pub struct OpClientError {
pub description: String,
pub validation_errors: Option<Vec<String>>,
pub status: Option<String>,
pub code: Option<u16>,
pub details: Option<HashMap<String, Value>>,
}Expand description
Error type for Open Payments client operations.
§Fields
description- Human-readable error messagevalidation_errors- Optional list of validation error messagesstatus- HTTP status code (only relevant for HTTP errors)code- Error code (only relevant for HTTP errors)details- Additional error details as key-value pairs
Fields§
§description: StringHuman-readable error description.
validation_errors: Option<Vec<String>>Optional list of validation error messages.
status: Option<String>HTTP status (only relevant for HTTP errors).
code: Option<u16>Error code (only relevant for HTTP errors).
details: Option<HashMap<String, Value>>Additional error details as key-value pairs.
Implementations§
Source§impl OpClientError
impl OpClientError
Sourcepub fn http(
description: impl Into<String>,
status: Option<String>,
code: Option<u16>,
) -> Self
pub fn http( description: impl Into<String>, status: Option<String>, code: Option<u16>, ) -> Self
Creates a new HTTP error with status code and optional error code.
Sourcepub fn validation(
description: impl Into<String>,
validation_errors: Vec<String>,
) -> Self
pub fn validation( description: impl Into<String>, validation_errors: Vec<String>, ) -> Self
Creates a new validation error with a list of validation messages.
Sourcepub fn other(description: impl Into<String>) -> Self
pub fn other(description: impl Into<String>) -> Self
Creates a new general error without HTTP-specific fields.
Sourcepub fn with_details(self, details: HashMap<String, Value>) -> Self
pub fn with_details(self, details: HashMap<String, Value>) -> Self
Adds additional details to the error.
Sourcepub fn with_detail(self, key: impl Into<String>, value: Value) -> Self
pub fn with_detail(self, key: impl Into<String>, value: Value) -> Self
Adds a single detail key-value pair to the error.
Trait Implementations§
Source§impl Debug for OpClientError
impl Debug for OpClientError
Source§impl Display for OpClientError
impl Display for OpClientError
Source§impl Error for OpClientError
impl Error for OpClientError
1.30.0 · 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<DecodeError> for OpClientError
impl From<DecodeError> for OpClientError
Source§fn from(err: DecodeError) -> Self
fn from(err: DecodeError) -> Self
Converts to this type from the input type.
Source§impl From<DecodeError> for Box<OpClientError>
impl From<DecodeError> for Box<OpClientError>
Source§fn from(err: DecodeError) -> Self
fn from(err: DecodeError) -> Self
Converts to this type from the input type.
Source§impl From<Error> for OpClientError
impl From<Error> for OpClientError
Source§impl From<Error> for OpClientError
impl From<Error> for OpClientError
Source§impl From<Error> for OpClientError
impl From<Error> for OpClientError
Source§impl From<ParseError> for OpClientError
impl From<ParseError> for OpClientError
Source§fn from(err: ParseError) -> Self
fn from(err: ParseError) -> Self
Converts to this type from the input type.
Source§impl From<ParseError> for Box<OpClientError>
impl From<ParseError> for Box<OpClientError>
Source§fn from(err: ParseError) -> Self
fn from(err: ParseError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for OpClientError
impl RefUnwindSafe for OpClientError
impl Send for OpClientError
impl Sync for OpClientError
impl Unpin for OpClientError
impl UnsafeUnpin for OpClientError
impl UnwindSafe for OpClientError
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