#[non_exhaustive]pub enum HttpError {
BodyNotUtf8,
EmptyBody,
Internal,
MethodNotAllowed {
allowed: &'static str,
},
NotAcceptable,
NotFound {
method: String,
path: String,
},
Unprocessable {
detail: String,
},
UnsupportedMediaType {
received: Option<String>,
},
}Expand description
HTTP-layer errors returned by the conversion API.
Each variant maps to a specific HTTP status code and is serialized as
an RFC 7807 Problem JSON body via IntoResponse.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
BodyNotUtf8
The request body bytes are not valid UTF-8.
→ HTTP 400 Bad Request.
EmptyBody
The request body was empty (Content-Length: 0 or no body).
→ HTTP 400 Bad Request.
Internal
An unexpected internal error occurred during conversion.
→ HTTP 500 Internal Server Error.
MethodNotAllowed
The HTTP method is not supported on this endpoint.
→ HTTP 405 Method Not Allowed (response includes an Allow header).
NotAcceptable
The Accept header excludes all formats this server produces.
→ HTTP 406 Not Acceptable.
NotFound
No route matches the requested method + path.
→ HTTP 404 Not Found.
Fields
Unprocessable
Document conversion failed due to invalid or malformed input.
→ HTTP 422 Unprocessable Entity.
UnsupportedMediaType
The Content-Type header is not one of the supported types: text/markdown, text/html, or application/vnd.openxmlformats-officedocument.wordprocessingml.document.
→ HTTP 415 Unsupported Media Type.
Implementations§
Source§impl HttpError
impl HttpError
Sourcepub fn error_class(&self) -> &'static str
pub fn error_class(&self) -> &'static str
Returns a stable, low-cardinality string identifying the error class. Safe to use as a Prometheus label value — never contains per-request data.
Sourcepub fn result_class(&self) -> &'static str
pub fn result_class(&self) -> &'static str
Returns the result class for Prometheus labels: "client_error" for 4xx, "server_error" for 5xx.
Trait Implementations§
Source§impl IntoResponse for HttpError
impl IntoResponse for HttpError
Source§fn into_response(self) -> Response
fn into_response(self) -> Response
Convert this error into an HTTP response with an RFC 7807 Problem JSON body.
Sets Content-Type: application/problem+json; charset=utf-8 and a JSON body
with exactly four fields: type, title, status, detail.
HttpError::MethodNotAllowed additionally sets the Allow response header.
Auto Trait Implementations§
impl Freeze for HttpError
impl RefUnwindSafe for HttpError
impl Send for HttpError
impl Sync for HttpError
impl Unpin for HttpError
impl UnsafeUnpin for HttpError
impl UnwindSafe for HttpError
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
Source§fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
Source§fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
Source§fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
Source§fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
Source§fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
Source§fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
Source§fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
Source§fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
Source§fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
x-request-id as the header name. Read moreSource§fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
Source§fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
x-request-id as the header name. Read more