use super::{indent, parse::PestError};
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
#[error("Parse error: {0}")]
PestError(#[from] PestError),
#[error("Integer parse error: {0}")]
ParseIntError(#[from] std::num::ParseIntError),
#[error("Float parse error: {0}")]
ParseFloatError(#[from] std::num::ParseFloatError),
#[error("Base64 decode error: {0}")]
Base64DecodeError(#[from] base64::DecodeError),
#[error("Invalid escape character: {0}")]
InvalidEscapeChar(char),
#[error("Invalid unicode escape: {0}")]
InvalidUnicodeEscape(String),
#[error("Invalid unicode codepoint: {0}")]
InvalidUnicodeCodepoint(u32),
#[error("Hex binary must have even number of digits")]
OddHexDigits,
#[error("Duplicate key in map: {0}")]
DuplicateKey(String),
#[error("Invalid timestamp '{0}': {1}")]
InvalidTimestamp(String, String),
#[error("Mixed tabs and spaces in indentation, got '{0:?}'")]
MixedIndent(String),
#[error("Inconsistent indent char: expected '{0}', got '{1}'")]
InconsistentIndentTab(indent::Tab, indent::Tab),
#[error("Invalid indentation: expected multiple of {0}, got {1}")]
InvalidIndentCount(usize, usize),
#[error("Unexpected indentation: expected {0}, got {1}")]
UnexpectedIndent(usize, usize),
#[error("Empty document")]
EmptyDocument,
#[error("Missing value at line {0}")]
MissingValue(usize),
}
pub type Result<T> = std::result::Result<T, Error>;