use std::io;
use thiserror::Error;
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Error, Debug)]
pub enum Error {
#[error("IO error: {0}")]
Io(#[from] io::Error),
#[error("Invalid record type: {0}")]
InvalidRecordType(u8),
#[error("Invalid binary type: {0}")]
InvalidBinaryType(u8),
#[error("Invalid primitive type: {0}")]
InvalidPrimitiveType(u8),
#[error("Invalid UTF-8 string")]
InvalidUtf8(#[from] std::string::FromUtf8Error),
#[error("Invalid length-prefixed string: {0}")]
InvalidStringLength(i32),
#[error("Custom error: {0}")]
Custom(String),
}