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