#[non_exhaustive]pub enum RuntimeError {
Serialization(Error),
InternalFailure(Error),
NotAcceptable,
UnsupportedMediaType,
Validation(String),
}Expand description
A protocol-independent extractor rejection framed by the selected schema protocol.
Use this error with impl<P> FromParts<P> extractors on single-protocol or multi-protocol
services. Schema upgrades call [IntoResponse::into_response_with_protocol], which delegates
to crate::schema::ServerProtocol::serialize_runtime_error. Existing protocol-specific
runtime-error types and their conversions remain available for explicitly static framing.
A direct [IntoResponse::into_response] call has no selected protocol: it returns an empty
response with the semantic status and a RuntimeErrorExtension, without protocol headers.
Supply a protocol to the context-aware method when direct conversion needs protocol framing.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Serialization(Error)
Request deserialization or response serialization failed.
InternalFailure(Error)
Internal framework or service state required by an extractor is unavailable.
NotAcceptable
The request’s Accept header cannot accept the response content type.
UnsupportedMediaType
The request’s Content-Type does not match the expected content type.
Validation(String)
An extractor rejected the request with a validation reason.
This is a runtime validation response, distinct from a modeled constraint violation.
Each protocol frames the reason in its response format, or discards it where its
existing runtime validation response omits the message.
This variant does not carry a modeled error shape. Custom modeled validation errors
retain their schema through crate::schema::DeserializeError::ConstraintViolation.
Implementations§
Source§impl RuntimeError
impl RuntimeError
Sourcepub fn name(&self) -> &'static str
pub fn name(&self) -> &'static str
The error name used by protocol framing and RuntimeErrorExtension.
Sourcepub fn status_code(&self) -> StatusCode
pub fn status_code(&self) -> StatusCode
The semantic status used when conversion has no selected protocol.
Trait Implementations§
Source§impl Debug for RuntimeError
impl Debug for RuntimeError
Source§impl Display for RuntimeError
impl Display for RuntimeError
Source§impl Error for RuntimeError
impl Error for RuntimeError
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<InternalFailureException> for RuntimeError
impl From<InternalFailureException> for RuntimeError
Source§fn from(_: InternalFailureException) -> Self
fn from(_: InternalFailureException) -> Self
Auto Trait Implementations§
impl Freeze for RuntimeError
impl !RefUnwindSafe for RuntimeError
impl Send for RuntimeError
impl Sync for RuntimeError
impl Unpin for RuntimeError
impl UnsafeUnpin for RuntimeError
impl !UnwindSafe for RuntimeError
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> 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