From c0ea8503db90f1bb9554f9ab9336422c54191d4b Mon Sep 17 00:00:00 2001 From: grandizzy Date: Mon, 21 Oct 2024 14:29:53 +0300 Subject: [PATCH] fix(cheatcodes): chain report source errors --- crates/cheatcodes/src/error.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/crates/cheatcodes/src/error.rs b/crates/cheatcodes/src/error.rs index 85be519bfd5e..d459e9274bb2 100644 --- a/crates/cheatcodes/src/error.rs +++ b/crates/cheatcodes/src/error.rs @@ -293,7 +293,6 @@ impl_from!( alloy_primitives::SignatureError, FsPathError, hex::FromHexError, - eyre::Error, BackendError, DatabaseError, jsonpath_lib::JsonPathError, @@ -316,6 +315,17 @@ impl> From> for Error { } } +impl From for Error { + #[inline] + fn from(err: eyre::Report) -> Self { + let mut chained_cause = String::new(); + for cause in err.chain() { + chained_cause.push_str(format!(" {cause};").as_str()); + } + Self::display(chained_cause) + } +} + #[cfg(test)] mod tests { use super::*;