zinkc/result.rs
1//! Zinkc result
2
3/// Zinkc errors
4#[derive(Debug, thiserror::Error)]
5pub enum Error {
6 /// Failed to do sth.
7 #[error(transparent)]
8 Anyhow(#[from] anyhow::Error),
9 /// Failed to parse WASM with binary reader.
10 #[error(transparent)]
11 BinaryReader(#[from] wasmparser::BinaryReaderError),
12 /// Failed to push more data to the buffer.
13 #[error("Buffer overflow: {0}, the limit of the binary buffer is 0x6000.")]
14 BufferOverflow(usize),
15 /// Failed in code generation.
16 #[error(transparent)]
17 Codegen(#[from] zingen::Error),
18 /// Failed to parse WASM data with data reader.
19 #[error("Invalid data offset")]
20 InvalidDataOffset,
21}
22
23/// Zinkc result
24pub type Result<T> = std::result::Result<T, Error>;