Match statement for handling error messages - reverted and default case (#3640)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Chris Evanko
2023-07-06 13:16:01 -04:00
committed by GitHub
parent a66a1286a4
commit bfa84bb1b7

View File

@ -161,7 +161,10 @@ impl CallTrace {
/// Returns the error message if it is an erroneous result.
pub(crate) fn as_error(&self) -> Option<String> {
self.is_error().then(|| format!("{:?}", self.status))
self.is_error().then(|| match self.status {
InstructionResult::Revert => "Reverted".to_string(),
status => format!("{:?}", status),
})
}
}