use thiserror::Error;
use crate::types::NbtString;
#[derive(Debug, Error, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub enum ParseError {
#[error("Invalid tag ID: {0}")]
InvalidTagId(u8),
#[error("Unexpected end of input")]
UnexpectedEndOfInput,
#[error("Invalid UTF-8 data")]
InvalidUtf8,
#[error("Negative length encountered: {0}")]
NegativeLength(i32),
#[error("Leftover data: {0} bytes")]
LeftoverData(usize),
#[error("Duplicate tag name")]
DuplicateTagName(NbtString),
#[error("Not an NBT file")]
NotNBT,
}
#[derive(Debug, Error, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub enum ValidationError {
#[error("The array is to long {0}/{max}", max = i32::MAX)]
ArrayTooLong(usize),
#[error("The string is to long {0}/{max}", max = u16::MAX)]
StringTooLong(usize),
}