mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-05 01:38:44 +00:00
29 lines
628 B
Rust
29 lines
628 B
Rust
use std::error::Error;
|
|
use std::fmt::{Display, Formatter};
|
|
|
|
#[derive(Debug)]
|
|
pub enum SqliteTasksError {
|
|
SqlxError(sqlx::Error),
|
|
//TaskNotFound,
|
|
//TaskAlreadyExists,
|
|
//InvalidTaskStatus,
|
|
//InvalidTaskType,
|
|
//InvalidGenerationProvider,
|
|
}
|
|
|
|
impl Error for SqliteTasksError {}
|
|
|
|
impl Display for SqliteTasksError {
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
match self {
|
|
SqliteTasksError::SqlxError(err) => write!(f, "SQLx error: {}", err),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<sqlx::Error> for SqliteTasksError {
|
|
fn from(err: sqlx::Error) -> Self {
|
|
SqliteTasksError::SqlxError(err)
|
|
}
|
|
}
|