use thiserror::Error;

#[derive(Debug, Error)]
pub enum DecodeError {
    #[error("unexpected EOF at byte offset {offset}: need {need} more byte(s)")]
    UnexpectedEof { offset: usize, need: usize },
    #[error("trailing bytes after top-level value: decoded {decoded}, total {total}")]
    TrailingBytes { decoded: usize, total: usize },
    #[error("unknown enum variant tag {tag} at offset {offset}")]
    UnknownVariant { tag: u8, offset: usize },
    #[error("invalid UTF-8 in string at offset {offset}")]
    InvalidUtf8 { offset: usize },
    #[error("invalid JSON at offset {offset}")]
    InvalidJson { offset: usize },
    #[error("Typ::Custom decoding not supported in v1")]
    CustomUnsupported,
}
