pub enum Error {
MalformedMultipart,
BadRequest(String),
StreamReadError,
MissingField,
IoError(Error),
Unauthorized(String),
Internal(Error),
NotFound(String),
InvalidHeader(InvalidHeaderValue),
}Expand description
Errors that can occur while processing an HTTP API request.
These are split into two categories:
- Client errors (4xx): Safe to return directly to the caller. They indicate the client sent something malformed or unauthorized.
- Internal errors (5xx): Must never expose implementation details. The
IntoResponseimplementation strips these down to a generic message before sending.
Variants§
MalformedMultipart
The multipart form body was structurally invalid and could not be parsed.
BadRequest(String)
The client sent a request that violates the API contract.
The inner String contains a human-readable explanation safe to send back.
StreamReadError
Reading the request body stream failed mid-transfer. This is typically a network issue on the client side.
MissingField
A required field was absent from the request body or headers.
IoError(Error)
An I/O error occurred while processing the request, such as writing a temporary file to disk. This is an internal failure.
The request could not be authenticated. The inner String contains
a message safe to return (e.g., “Missing Header”, “Invalid token”).
Internal(Error)
A low-level internal error, typically from integer or time conversions.
NotFound(String)
The requested resource does not exist or is not accessible to the caller.
The inner String contains a message safe to return to the client.
InvalidHeader(InvalidHeaderValue)
A header value provided in the response could not be parsed. This is almost always a bug in the server code, not the client.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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()
Auto Trait Implementations§
impl !RefUnwindSafe for Error
impl !UnwindSafe for Error
impl Freeze for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
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
Source§impl<T> Color for Twhere
T: Display,
impl<T> Color for Twhere
T: Display,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more