pub struct InternalServerError<T>(pub T);Available on crate feature
error-response only.Expand description
Convenience response to create an error response from a non-IntoResponse error
This provides a method to quickly respond with an error that does not implement
the IntoResponse trait itself. Error details are logged using tracing::error!
and a generic 500 Internal Server Error response is returned to the client without
exposing error details.
use axum_extra::response::InternalServerError;
use axum_core::response::IntoResponse;
async fn maybe_error() -> Result<String, InternalServerError<Error>> {
try_thing().map_err(InternalServerError)?;
// do something on success
}Tuple Fields§
§0: TTrait Implementations§
Source§impl<T: Debug> Debug for InternalServerError<T>
impl<T: Debug> Debug for InternalServerError<T>
Source§impl<T: Error + 'static> IntoResponse for InternalServerError<T>
impl<T: Error + 'static> IntoResponse for InternalServerError<T>
Source§fn into_response(self) -> Response
fn into_response(self) -> Response
Create a response.
Auto Trait Implementations§
impl<T> Freeze for InternalServerError<T>where
T: Freeze,
impl<T> RefUnwindSafe for InternalServerError<T>where
T: RefUnwindSafe,
impl<T> Send for InternalServerError<T>where
T: Send,
impl<T> Sync for InternalServerError<T>where
T: Sync,
impl<T> Unpin for InternalServerError<T>where
T: Unpin,
impl<T> UnsafeUnpin for InternalServerError<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for InternalServerError<T>where
T: UnwindSafe,
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
Mutably borrows from an owned value. Read more