axum_msgpack/error.rs
1use std::{error::Error as StdError, fmt};
2
3use axum::BoxError;
4
5#[derive(Debug)]
6pub struct Error {
7 inner: BoxError,
8}
9
10impl Error {
11 pub(crate) fn new(error: impl Into<BoxError>) -> Self {
12 Self {
13 inner: error.into(),
14 }
15 }
16}
17
18impl fmt::Display for Error {
19 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
20 self.inner.fmt(f)
21 }
22}
23
24impl StdError for Error {
25 fn source(&self) -> Option<&(dyn StdError + 'static)> {
26 Some(&*self.inner)
27 }
28}