Skip to main content

chia_generator_parser/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum GeneratorParserError {
5    #[error("Invalid block format: {0}")]
6    InvalidBlockFormat(String),
7
8    #[error("Buffer too short: expected at least {expected} bytes, got {actual}")]
9    BufferTooShort { expected: usize, actual: usize },
10
11    #[error("Invalid generator bytecode: {0}")]
12    InvalidGeneratorBytecode(String),
13
14    #[error("CLVM parsing error: {0}")]
15    ClvmParsingError(String),
16
17    #[error("CLVM execution error: {0}")]
18    ClvmExecutionError(String),
19
20    #[error("Serialization error: {0}")]
21    SerializationError(String),
22
23    #[error("Hex decoding error: {0}")]
24    HexDecodingError(#[from] hex::FromHexError),
25}
26
27pub type Result<T> = std::result::Result<T, GeneratorParserError>;