#[non_exhaustive]pub struct RequestError { /* private fields */ }Expand description
A request-level JMAP error response: HTTP status code + JMAP error body.
Used when an error occurs before method dispatch (e.g., parse failure,
unknown capability). Derives the HTTP status from the error type via
error_status. Use request_error to construct.
Call RequestError::into_response to produce an http::Response<String>
with the RFC 9457 problem details body. Any HTTP framework that works with
the http crate (axum, hyper, warp, etc.) accepts this directly.
Implementations§
Source§impl RequestError
impl RequestError
Sourcepub fn problem_details(&self) -> ProblemDetails
pub fn problem_details(&self) -> ProblemDetails
The RFC 9457 problem details of this error (RFC 8620 §3.6.1): type
urn:ietf:params:jmap:error:<type>, status, detail from the
description, and limit for limit errors. Add a localized title
and send it with problem_response.
Sourcepub fn status(&self) -> StatusCode
pub fn status(&self) -> StatusCode
The HTTP status code.
Sourcepub fn into_response(self) -> Response<String>
pub fn into_response(self) -> Response<String>
Convert into an HTTP response with an RFC 9457 problem details body
(Self::problem_details, problem_response) and no
Content-Language.
Trait Implementations§
Source§impl Debug for RequestError
impl Debug for RequestError
Source§impl Display for RequestError
impl Display for RequestError
Source§impl Error for RequestError
impl Error for RequestError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<JmapError> for RequestError
impl From<JmapError> for RequestError
Source§fn from(err: JmapError) -> Self
fn from(err: JmapError) -> Self
Convert a JmapError into a RequestError, deriving the HTTP
status code automatically via error_status.
Enables ? propagation in functions returning Result<_, RequestError>.
Pass only request-level errors; see error_status for the safe list.
Auto Trait Implementations§
impl Forget for RequestError
impl Freeze for RequestError
impl Move for RequestError
impl RefUnwindSafe for RequestError
impl Send for RequestError
impl Sync for RequestError
impl Unpin for RequestError
impl UnsafeUnpin for RequestError
impl UnwindSafe for RequestError
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.