chik_traits/
chik_error.rs1use thiserror::Error;
2
3#[derive(Debug, PartialEq, Eq, Clone, Error)]
4pub enum Error {
5 #[error("invalid bool encoding")]
6 InvalidBool,
7 #[error("invalid optional encoding")]
8 InvalidOptional,
9 #[error("unexpected end of buffer")]
10 EndOfBuffer,
11 #[error("invalid string encoding")]
12 InvalidString,
13 #[error("input buffer too large")]
14 InputTooLarge,
15 #[error("sequence too large")]
16 SequenceTooLarge,
17 #[error("invalid enum value")]
18 InvalidEnum,
19 #[error("invalid KLVM serialization")]
20 InvalidKlvm,
21 #[error("invalid pot iteration")]
22 InvalidPotIteration,
23 #[error("{0}")]
24 Custom(String),
25}
26
27pub type Result<T> = std::result::Result<T, Error>;
28
29#[cfg(feature = "py-bindings")]
30impl From<Error> for pyo3::PyErr {
31 fn from(err: Error) -> pyo3::PyErr {
32 pyo3::exceptions::PyValueError::new_err(err.to_string())
33 }
34}