use crate::alloc::string::String;
#[derive(Debug, thiserror::Error)]
pub enum WCError {
#[error("Not Implemented: {0}")]
NotImplemented(String),
#[error("Resource Not Found: {0}")]
ResourceNotFound(String),
#[error("Duplicate: {0}")]
DuplicatedResource(String),
#[error("vocab size ({size}) exceeds token type capacity")]
VocabSizeOverflow {
size: usize,
},
#[error("vocab size ({size}) must be >= 256")]
VocabSizeTooSmall {
size: usize,
},
#[error("Vocab Conflict: {0}")]
VocabConflict(String),
#[error("token out of range")]
TokenOutOfRange,
#[error("incomplete decode: {remaining} remaining tokens")]
IncompleteDecode {
remaining: usize,
},
#[cfg(feature = "std")]
#[error(transparent)]
Io(#[from] std::io::Error),
#[error("parse error: {0}")]
Parse(String),
#[error("{0}")]
External(String),
}
pub type WCResult<T> = core::result::Result<T, WCError>;