Skip to main content

schema_risk/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum SchemaRiskError {
5    #[error("IO error: {0}")]
6    Io(#[from] std::io::Error),
7
8    #[error("SQL parse error: {0}")]
9    Parse(String),
10
11    #[error("Invalid migration file: {0}")]
12    InvalidMigration(String),
13
14    #[error("Analysis failed: {0}")]
15    Analysis(String),
16
17    #[error("No SQL files found matching: {0}")]
18    NoFilesFound(String),
19
20    #[error("Database connection failed: {0}")]
21    DbConnect(String),
22
23    #[error("Database query failed: {0}")]
24    DbQuery(String),
25
26    #[error("Feature '{0}' is not enabled — rebuild with `--features {0}`")]
27    FeatureDisabled(String),
28}
29
30pub type Result<T> = std::result::Result<T, SchemaRiskError>;