pub struct ErrorResponse {
pub error: String,
pub error_type: String,
pub status_code: u16,
pub x402_version: u32,
pub details: Option<Value>,
}Expand description
Unified error response structure
Fields§
§error: StringError message
error_type: StringError type
status_code: u16HTTP status code
x402_version: u32Protocol version
details: Option<Value>Additional error details
Implementations§
Source§impl ErrorResponse
impl ErrorResponse
Sourcepub fn from_x402_error(error: &X402Error) -> Self
pub fn from_x402_error(error: &X402Error) -> Self
Create a new error response from X402Error
Sourcepub fn new(
error: impl Into<String>,
error_type: impl Into<String>,
status_code: u16,
) -> Self
pub fn new( error: impl Into<String>, error_type: impl Into<String>, status_code: u16, ) -> Self
Create a new error response with custom message
Sourcepub fn with_details(self, details: Value) -> Self
pub fn with_details(self, details: Value) -> Self
Add error details
Trait Implementations§
Source§impl Clone for ErrorResponse
impl Clone for ErrorResponse
Source§fn clone(&self) -> ErrorResponse
fn clone(&self) -> ErrorResponse
Returns a duplicate of the value. Read more
1.0.0 · 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 ErrorResponse
impl Debug for ErrorResponse
Source§impl From<&X402Error> for ErrorResponse
impl From<&X402Error> for ErrorResponse
Auto Trait Implementations§
impl Freeze for ErrorResponse
impl RefUnwindSafe for ErrorResponse
impl Send for ErrorResponse
impl Sync for ErrorResponse
impl Unpin for ErrorResponse
impl UnwindSafe for ErrorResponse
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