ferriorm_runtime/error.rs
1//! Unified error type for ferriorm runtime operations.
2//!
3//! [`FerriormError`] wraps sqlx database errors and adds ferriorm-specific variants
4//! for not-found conditions, query-building failures, and connection issues.
5
6use thiserror::Error;
7
8#[derive(Debug, Error)]
9pub enum FerriormError {
10 #[error("Database error: {0}")]
11 Database(#[from] sqlx::Error),
12
13 #[error("Record not found")]
14 NotFound,
15
16 #[error("Query error: {0}")]
17 Query(String),
18
19 #[error("Connection error: {0}")]
20 Connection(String),
21
22 #[error("{0}")]
23 Other(String),
24}
25
26impl From<String> for FerriormError {
27 fn from(s: String) -> Self {
28 Self::Other(s)
29 }
30}