mcnbt/
errors.rs

1use thiserror::Error;
2
3#[derive(Error, Debug)]
4pub enum Error {
5    #[error("expected tag to have a name")]
6    MissingName,
7
8    #[error("the amount of tags of the byte array must not exceed {}", i32::MAX)]
9    ByteArrayTooBig,
10
11    #[error("the length of the string (in bytes) must not exceed {}", u16::MAX)]
12    StringTooBig,
13
14    #[error("the amount of tags of the list must not exceed {}", i32::MAX)]
15    ListTooBig,
16
17    #[error("the amount of tags of the int array must not exceed {}", i32::MAX)]
18    IntArrayTooBig,
19
20    #[error("the amount of tags of the long array must not exceed {}", i32::MAX)]
21    LongArrayTooBig,
22
23    // TODO: improve this
24    #[error("failed to parse NBT")]
25    ParseError(nom::error::ErrorKind),
26
27    #[error("NBT is incomplete")]
28    Incomplete(nom::Needed),
29}