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. This type should only be used for debugging purposes or internal
facing applications, as it includes the full error chain with descriptions,
thus leaking information that could possibly be sensitive.
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: T
Trait 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> 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