52 lines
1.0 KiB
Rust
52 lines
1.0 KiB
Rust
use serde::Serialize;
|
|
|
|
#[derive(Debug, thiserror::Error)]
|
|
pub enum TuskError {
|
|
#[error("Database error: {0}")]
|
|
Database(#[from] sqlx::Error),
|
|
|
|
#[error("IO error: {0}")]
|
|
Io(#[from] std::io::Error),
|
|
|
|
#[error("Serialization error: {0}")]
|
|
Serde(#[from] serde_json::Error),
|
|
|
|
#[error("Connection not found: {0}")]
|
|
ConnectionNotFound(String),
|
|
|
|
#[error("Not connected: {0}")]
|
|
NotConnected(String),
|
|
|
|
#[error("Connection is in read-only mode")]
|
|
ReadOnly,
|
|
|
|
#[error("AI error: {0}")]
|
|
Ai(String),
|
|
|
|
#[error("Docker error: {0}")]
|
|
Docker(String),
|
|
|
|
#[error("Configuration error: {0}")]
|
|
Config(String),
|
|
|
|
#[error("Validation error: {0}")]
|
|
Validation(String),
|
|
|
|
#[error("Export error: {0}")]
|
|
Export(String),
|
|
|
|
#[error("{0}")]
|
|
Custom(String),
|
|
}
|
|
|
|
impl Serialize for TuskError {
|
|
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
|
where
|
|
S: serde::Serializer,
|
|
{
|
|
serializer.serialize_str(&self.to_string())
|
|
}
|
|
}
|
|
|
|
pub type TuskResult<T> = Result<T, TuskError>;
|