Skip to main content

laya_core/
error.rs

1use std::path::PathBuf;
2
3#[derive(Debug, thiserror::Error)]
4pub enum Error {
5    #[error("{0}")]
6    Question(String),
7
8    #[error("{0}")]
9    Config(String),
10
11    #[error("Tokenizer is missing a valid {0}")]
12    MissingSpecialToken(&'static str),
13
14    #[error("failed to load tokenizer from {path}: {message}")]
15    Tokenizer { path: PathBuf, message: String },
16
17    #[error("{path} is missing")]
18    MissingFile { path: PathBuf },
19
20    #[error(transparent)]
21    Io(#[from] std::io::Error),
22
23    #[error(transparent)]
24    Json(#[from] serde_json::Error),
25}
26
27pub type Result<T> = std::result::Result<T, Error>;