diff options
Diffstat (limited to 'crates/parser/src/error.rs')
| -rw-r--r-- | crates/parser/src/error.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/crates/parser/src/error.rs b/crates/parser/src/error.rs new file mode 100644 index 0000000..c99fa01 --- /dev/null +++ b/crates/parser/src/error.rs @@ -0,0 +1,25 @@ +use alloc::string::{String, ToString}; +use wasmparser::Encoding; + +pub enum ParseError { + UnsupportedSection(String), + DuplicateSection(String), + EmptySection(String), + UnsupportedOperator(String), + ParseError { message: String, offset: usize }, + InvalidEncoding(Encoding), + InvalidLocalCount { expected: u32, actual: u32 }, + EndNotReached, + Other(String), +} + +impl From<wasmparser::BinaryReaderError> for ParseError { + fn from(value: wasmparser::BinaryReaderError) -> Self { + Self::ParseError { + message: value.message().to_string(), + offset: value.offset(), + } + } +} + +pub type Result<T, E = ParseError> = core::result::Result<T, E>; |
