alloy_hardforks/
error.rs

1#[derive(Debug)]
2/// Error type for hardfork related errors.
3pub struct ParseHardforkError(alloc::string::String);
4
5impl ParseHardforkError {
6    /// Creates a new hardfork parse error with the given message
7    pub fn new<S: Into<alloc::string::String>>(msg: S) -> Self {
8        Self(msg.into())
9    }
10
11    /// Returns the error message
12    pub fn message(&self) -> &str {
13        &self.0
14    }
15}
16
17impl core::fmt::Display for ParseHardforkError {
18    fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
19        write!(f, "{}", self.0)
20    }
21}
22
23impl core::error::Error for ParseHardforkError {}