#[non_exhaustive]pub enum HttpError {
BodyNotUtf8,
EmptyBody,
Internal {
source: Box<dyn Error + Send + Sync + 'static>,
},
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.
The source error is captured for observability (sent to Sentry via
sentry::capture_error, logged at warn! in stderr) and drives the
error chain visible to operators. It is never exposed to the HTTP
client — the RFC 7807 response detail is always the generic
“An unexpected error occurred during conversion” string.
→ HTTP 500 Internal Server Error.
Fields
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.
Sourcepub fn internal<E>(source: E) -> Self
pub fn internal<E>(source: E) -> Self
Wrap an unexpected internal error as HttpError::Internal.
The source is preserved end-to-end for observability — it flows to
Sentry via sentry::capture_error (walking the core::error::Error::source
chain) and is logged at warn! level via core::fmt::Debug formatting.
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 !RefUnwindSafe for HttpError
impl !UnwindSafe for HttpError
impl Freeze for HttpError
impl Send for HttpError
impl Sync for HttpError
impl Unpin for HttpError
impl UnsafeUnpin 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
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
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 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