leetcode_tui_db/
errors.rs

1use std::num::ParseIntError;
2
3use native_db::db_type;
4use thiserror::Error;
5
6#[derive(Error, Debug)]
7pub enum DbErr {
8    #[error("NativeDbError encountered {0}")]
9    NativeDbError(#[from] db_type::Error),
10
11    #[error("Could not create topic {0}")]
12    TopicCreateError(String),
13
14    #[error("FrontEndQuestionIdParseError: {0}")]
15    FrontEndQuestionIdParseError(#[from] ParseIntError),
16
17    #[error("Question not found: {0}")]
18    QuestionsNotFoundInDb(String),
19
20    #[error("Topic not found: {0}")]
21    TopicsNotFoundInDb(String),
22}
23
24pub type DBResult<T> = Result<T, DbErr>;