EOF_Parser/
error.rs

1use std::io;
2pub use thiserror::Error;
3
4#[derive(Debug, Error)]
5pub enum Error {
6    /// Invalid Magic Number
7    #[error("Invalid EOF magic number")]
8    InvalidMagic,
9
10    /// Triggers when the EOF version is invalid
11    #[error("Invalid EOF version")]
12    InvalidVersion,
13
14    /// Triggers when the number of code sections is invalid: a lot of reasons of this
15    #[error("Invalid number of code sections")]
16    InvalidCodeSectionCount,
17
18    /// Triggers when the section size is invalid
19    #[error("Invalid type section size")]
20    InvalidTypeSectionSize,
21
22    /// Invalid Metadata
23    #[error("Invalid metadata for 0th code section")]
24    InvalidZeroSectionMetadata,
25
26    /// Parsing Error
27    #[error("Parsing error: {0}")]
28    ParseError(String),
29
30    /// I/O Error
31    #[error("I/O error: {0}")]
32    IoError(#[from] io::Error),
33}