zinkc/
result.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
//! Zinkc result

/// Zinkc errors
#[derive(Debug, thiserror::Error)]
pub enum Error {
    /// Failed to do sth.
    #[error(transparent)]
    Anyhow(#[from] anyhow::Error),
    /// Failed to parse WASM with binary reader.
    #[error(transparent)]
    BinaryReader(#[from] wasmparser::BinaryReaderError),
    /// Failed to push more data to the buffer.
    #[error("Buffer overflow: {0}, the limit of the binary buffer is 0x6000.")]
    BufferOverflow(usize),
    /// Failed in code generation.
    #[error(transparent)]
    Codegen(#[from] zingen::Error),
    /// Failed to parse WASM data with data reader.
    #[error("Invalid data offset")]
    InvalidDataOffset,
}

/// Zinkc result
pub type Result<T> = std::result::Result<T, Error>;