diff options
| author | Henry Gressmann <mail@henrygressmann.de> | 2024-01-31 00:03:42 +0100 |
|---|---|---|
| committer | Henry Gressmann <mail@henrygressmann.de> | 2024-01-31 00:03:42 +0100 |
| commit | 6850e8bc669171c658696655f4f31996d6e934af (patch) | |
| tree | 6efb61f6dc9790dd219a8bf7e39ab2434af3140a /crates/parser/src/error.rs | |
| parent | 712b7da4f6b20a9754dd78be632988bbb66f2cbe (diff) | |
chore: overall code cleanup
Signed-off-by: Henry Gressmann <mail@henrygressmann.de>
Diffstat (limited to 'crates/parser/src/error.rs')
| -rw-r--r-- | crates/parser/src/error.rs | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/crates/parser/src/error.rs b/crates/parser/src/error.rs index 35bad28..76d806d 100644 --- a/crates/parser/src/error.rs +++ b/crates/parser/src/error.rs @@ -6,15 +6,35 @@ use wasmparser::Encoding; #[derive(Debug)] /// Errors that can occur when parsing a WebAssembly module pub enum ParseError { + /// An invalid type was encountered InvalidType, + /// An unsupported section was encountered UnsupportedSection(String), + /// A duplicate section was encountered DuplicateSection(String), + /// An empty section was encountered EmptySection(String), + /// An unsupported operator was encountered UnsupportedOperator(String), - ParseError { message: String, offset: usize }, + /// An error occurred while parsing the module + ParseError { + /// The error message + message: String, + /// The offset in the module where the error occurred + offset: usize, + }, + /// An invalid encoding was encountered InvalidEncoding(Encoding), - InvalidLocalCount { expected: u32, actual: u32 }, + /// An invalid local count was encountered + InvalidLocalCount { + /// The expected local count + expected: u32, + /// The actual local count + actual: u32, + }, + /// The end of the module was not reached EndNotReached, + /// An unknown error occurred Other(String), } @@ -48,4 +68,4 @@ impl From<wasmparser::BinaryReaderError> for ParseError { } } -pub type Result<T, E = ParseError> = core::result::Result<T, E>; +pub(crate) type Result<T, E = ParseError> = core::result::Result<T, E>; |
