Skip to content

Commit

Permalink
fix(cheatcodes): improve fork cheatcodes messages (#9141)
Browse files Browse the repository at this point in the history
fix(cheatcodes): chain report source errors
  • Loading branch information
grandizzy authored Oct 21, 2024
1 parent 1af44bf commit 2044fae
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion crates/cheatcodes/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ impl_from!(
alloy_primitives::SignatureError,
FsPathError,
hex::FromHexError,
eyre::Error,
BackendError,
DatabaseError,
jsonpath_lib::JsonPathError,
Expand All @@ -316,6 +315,17 @@ impl<T: Into<BackendError>> From<EVMError<T>> for Error {
}
}

impl From<eyre::Report> 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::*;
Expand Down

0 comments on commit 2044fae

Please sign in to comment.