error.rs
This file
Path
axum-core/src/error.rs
35 lines · 757 bytes · Rust
Last changed by
Not known.
History of this fileTake it
The walk stopped after 200 commits: lines older than dcbcf5c point at it.
axum-extra: Make typed-routing feature enable routing feature (#3514)tottotobefore adoptiondcbcf5c
lines 1–35why, one step back1use crate::BoxError;2use std::{error::Error as StdError, fmt};34/// Errors that can happen when using axum.5#[derive(Debug)]6pub struct Error {7 inner: BoxError,8}910impl Error {11 /// Create a new `Error` from a boxable error.12 pub fn new(error: impl Into<BoxError>) -> Self {13 Self {14 inner: error.into(),15 }16 }1718 /// Convert an `Error` back into the underlying boxed trait object.19 #[must_use]20 pub fn into_inner(self) -> BoxError {21 self.inner22 }23}2425impl fmt::Display for Error {26 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {27 self.inner.fmt(f)28 }29}3031impl StdError for Error {32 fn source(&self) -> Option<&(dyn StdError + 'static)> {33 Some(&*self.inner)34 }35}