lambda_runtime_api_client/
error.rs

1//! Extracted from Axum under MIT license.
2//! <https://github.com/tokio-rs/axum/blob/main/axum/LICENSE>
3use std::{error::Error as StdError, fmt};
4pub use tower::BoxError;
5/// Errors that can happen when using axum.
6#[derive(Debug)]
7pub struct Error {
8    inner: BoxError,
9}
10
11impl Error {
12    /// Create a new `Error` from a boxable error.
13    pub fn new(error: impl Into<BoxError>) -> Self {
14        Self { inner: error.into() }
15    }
16
17    /// Convert an `Error` back into the underlying boxed trait object.
18    pub fn into_inner(self) -> BoxError {
19        self.inner
20    }
21}
22
23impl fmt::Display for Error {
24    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
25        self.inner.fmt(f)
26    }
27}
28
29impl StdError for Error {
30    fn source(&self) -> Option<&(dyn StdError + 'static)> {
31        Some(&*self.inner)
32    }
33}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.