revm_rwasm_bytecode/
decode_errors.rs1use crate::{eip7702::Eip7702DecodeError, ownable_account::OwnableAccountDecodeError};
2use core::fmt;
3
4#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
6#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
7pub enum BytecodeDecodeError {
8 Eip7702(Eip7702DecodeError),
10 OwnableAccount(OwnableAccountDecodeError),
12 Rwasm,
14}
15
16impl From<Eip7702DecodeError> for BytecodeDecodeError {
17 fn from(error: Eip7702DecodeError) -> Self {
18 Self::Eip7702(error)
19 }
20}
21
22impl From<OwnableAccountDecodeError> for BytecodeDecodeError {
23 fn from(error: OwnableAccountDecodeError) -> Self {
24 Self::OwnableAccount(error)
25 }
26}
27
28impl core::error::Error for BytecodeDecodeError {}
29
30impl fmt::Display for BytecodeDecodeError {
31 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
32 match self {
33 Self::Eip7702(e) => fmt::Display::fmt(e, f),
34 Self::OwnableAccount(e) => fmt::Display::fmt(e, f),
35 Self::Rwasm => fmt::Display::fmt("rwasm decode error", f),
36 }
37 }
38}