diff --git a/interpreter/src/error.rs b/interpreter/src/error.rs index aaf74fbcb..92ead5d0b 100644 --- a/interpreter/src/error.rs +++ b/interpreter/src/error.rs @@ -1,5 +1,6 @@ use crate::Opcode; use alloc::borrow::Cow; +use core::fmt; /// Capture represents the result of execution. #[derive(Clone, Copy, Debug, Eq, PartialEq)] @@ -54,23 +55,18 @@ impl From for ExitResult { } #[cfg(feature = "std")] -impl std::error::Error for ExitError { - fn description(&self) -> &str { +impl std::error::Error for ExitError {} + +impl fmt::Display for ExitError { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match self { - Self::Exception(_) => "EVM exit exception", - Self::Reverted => "EVM internal revert", - Self::Fatal(_) => "EVM fatal error", + Self::Exception(_) => f.write_str("EVM exit exception"), + Self::Reverted => f.write_str("EVM internal revert"), + Self::Fatal(_) => f.write_str("EVM fatal error"), } } } -#[cfg(feature = "std")] -impl std::fmt::Display for ExitError { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{self:?}") - } -} - /// Exit succeed reason. #[derive(Clone, Copy, Debug, Eq, PartialEq)] #[cfg_attr(