leetcode_tui_core/
errors.rs

1use std::{num::ParseIntError, path::PathBuf};
2
3use thiserror::Error;
4
5#[derive(Error, Debug)]
6pub enum CoreError {
7    #[error("{0}")]
8    IOError(#[from] std::io::Error),
9
10    #[error("Filename format does not match: {0}")]
11    FileNameFormatDoesNotMatch(PathBuf),
12
13    #[error("Couldn't parse language id: {0}")]
14    LangIdParseError(#[from] ParseIntError),
15
16    #[error("Filename does not exist for path: {0}")]
17    FileNameDoesNotExistError(PathBuf),
18
19    #[error("File name is not a valid utf8: {0}")]
20    Utf8ValidityError(PathBuf),
21
22    #[error("QuestionId: {0} does not exist")]
23    QuestionIdDoesNotExist(String),
24}
25
26pub type CoreResult<T> = Result<T, CoreError>;