alloy_network/any/
error.rs1use core::{error::Error, fmt};
4
5pub struct AnyConversionError {
7 inner: Box<dyn Error + Send + Sync + 'static>,
8}
9
10impl AnyConversionError {
11 pub fn new<E>(error: E) -> Self
13 where
14 E: Error + Send + Sync + 'static,
15 {
16 Self { inner: Box::new(error) }
17 }
18
19 pub fn as_error(&self) -> &(dyn Error + Send + Sync + 'static) {
21 self.inner.as_ref()
22 }
23}
24
25impl fmt::Debug for AnyConversionError {
26 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
27 fmt::Debug::fmt(&self.inner, f)
28 }
29}
30
31impl fmt::Display for AnyConversionError {
32 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
33 fmt::Display::fmt(&self.inner, f)
34 }
35}
36
37impl Error for AnyConversionError {
38 fn source(&self) -> Option<&(dyn Error + 'static)> {
39 self.inner.source()
40 }
41}