pub struct JsonApiErrorResponse {
pub status: StatusCode,
pub errors: Vec<JsonApiError>,
}Expand description
A comprehensive error type for JSON:API operations.
This struct integrates with Rust’s standard error handling by implementing
the std::error::Error trait. It includes an HTTP status code and a list
of JsonApiError objects, making it suitable for direct use in API handlers.
Fields§
§status: StatusCode§errors: Vec<JsonApiError>Implementations§
Source§impl JsonApiErrorResponse
impl JsonApiErrorResponse
Sourcepub fn new(status: StatusCode, errors: Vec<JsonApiError>) -> Self
pub fn new(status: StatusCode, errors: Vec<JsonApiError>) -> Self
Constructs a JsonApiErrorResponse from a status code and a list of errors.
Sourcepub fn to_document<T>(&self) -> JsonApiDocument<T>
pub fn to_document<T>(&self) -> JsonApiDocument<T>
Converts the error response into a JsonApiDocument for serialization.
Trait Implementations§
Source§impl Debug for JsonApiErrorResponse
impl Debug for JsonApiErrorResponse
Source§impl Display for JsonApiErrorResponse
impl Display for JsonApiErrorResponse
Source§impl Error for JsonApiErrorResponse
impl Error for JsonApiErrorResponse
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()
Auto Trait Implementations§
impl Freeze for JsonApiErrorResponse
impl RefUnwindSafe for JsonApiErrorResponse
impl Send for JsonApiErrorResponse
impl Sync for JsonApiErrorResponse
impl Unpin for JsonApiErrorResponse
impl UnsafeUnpin for JsonApiErrorResponse
impl UnwindSafe for JsonApiErrorResponse
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