#[derive(Debug, thiserror::Error)]
pub enum ParseError {
    #[error("missing @ header line")]
    MissingHeader,

    #[error("unterminated quoted string at byte {0}")]
    UnterminatedString(usize),

    #[error("duplicate field: {0}")]
    DuplicateField(String),

    #[error("malformed list at byte {0}")]
    MalformedList(usize),

    #[error("invalid directive: {0}")]
    InvalidDirective(String),

    #[error("empty run_id")]
    EmptyRunId,

    #[error("packet exceeds maximum size ({0} bytes)")]
    PacketTooLarge(usize),

    #[error("too many fields (max {0})")]
    TooManyFields(usize),

    #[error("field too long at byte {0}")]
    FieldTooLong(usize),

    #[error("invalid field syntax at line {0}: expected name=value")]
    InvalidField(usize),
}

#[derive(Debug, thiserror::Error)]
pub enum ValidationError {
    #[error("syntax error: {0}")]
    Syntax(String),

    #[error("schema error: {0}")]
    Schema(String),
}
