HomeDisk/src/database/error.rs

20 lines
574 B
Rust
Raw Normal View History

2022-06-23 09:52:48 +00:00
use thiserror::Error;
#[derive(Debug, Error, PartialEq, Eq, PartialOrd, Ord)]
pub enum Error {
2022-09-18 13:14:25 +00:00
#[error("User not found")]
UserNotFound,
2022-09-18 13:14:25 +00:00
#[error("Failed to open database: {0}")]
OpenDatabase(String),
2022-09-18 13:14:25 +00:00
#[error("Failed to open connection with database: {0}")]
ConnectDatabase(String),
2022-09-18 13:14:25 +00:00
#[error("Failed to get row: {0}")]
GetRow(String),
2022-09-18 13:14:25 +00:00
#[error("Failed to create all required tables: {0}")]
CreateTables(String),
2022-09-18 13:14:25 +00:00
#[error("Failed to execute the query: {0}")]
Execute(String),
}
2022-06-23 09:52:48 +00:00
pub type Result<T> = std::result::Result<T, Error>;