Skip to main content

amaru_uplc/flat/decode/
error.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum FlatDecodeError {
5    #[error("Reached end of buffer")]
6    EndOfBuffer,
7    #[error("Buffer is not byte aligned")]
8    BufferNotByteAligned,
9    #[error("Incorrect value of num_bits, must be less than 9")]
10    IncorrectNumBits,
11    #[error("Not enough data available, required {0} bytes")]
12    NotEnoughBytes(usize),
13    #[error("Not enough data available, required {0} bits")]
14    NotEnoughBits(usize),
15    #[error(transparent)]
16    DecodeUtf8(#[from] std::str::Utf8Error),
17    #[error(transparent)]
18    DecodeCbor(#[from] minicbor::decode::Error),
19    #[error("Decoding u32 to char {0}")]
20    DecodeChar(u32),
21    #[error("{0}")]
22    Message(String),
23    #[error("Default Function not found: {0}")]
24    DefaultFunctionNotFound(u8),
25    #[error("Unknown term constructor tag: {0}")]
26    UnknownTermConstructor(u8),
27    #[error("Unknown constant constructor tag: {0:#?}")]
28    UnknownConstantConstructor(Vec<u8>),
29    #[error("Unknown type tags: {0:#?}")]
30    UnknownTypeTags(Vec<u8>),
31    #[error("Missing type tag")]
32    MissingTypeTag,
33    #[error("BLS type not supported")]
34    BlsTypeNotSupported,
35    #[error("Trailing bytes after script: {0} bytes remaining")]
36    TrailingBytes(usize),
37    #[error("Builtin function {1} (tag {0}) is not available in the given language version")]
38    BuiltinNotAvailable(u8, String),
39}