kimberlite_migration/
error.rs1use std::path::PathBuf;
4use thiserror::Error;
5
6#[derive(Error, Debug)]
8pub enum Error {
9 #[error("IO error: {0}")]
11 Io(#[from] std::io::Error),
12
13 #[error("Failed to parse migration file {path}: {reason}")]
15 ParseError { path: PathBuf, reason: String },
16
17 #[error("Migration file not found: {0}")]
19 NotFound(PathBuf),
20
21 #[error("Invalid migration sequence: expected {expected}, found {found}")]
23 InvalidSequence { expected: u32, found: u32 },
24
25 #[error("Checksum mismatch for migration {id}: expected {expected}, found {actual}")]
27 ChecksumMismatch {
28 id: u32,
29 expected: String,
30 actual: String,
31 },
32
33 #[error("Migration {0} has already been applied")]
35 AlreadyApplied(u32),
36
37 #[error("Invalid migration name: {0}")]
39 InvalidName(String),
40
41 #[error("Lock file error: {0}")]
43 LockFile(String),
44
45 #[error("TOML error: {0}")]
47 Toml(#[from] toml::de::Error),
48
49 #[error("TOML serialization error: {0}")]
51 TomlSer(#[from] toml::ser::Error),
52}
53
54pub type Result<T> = std::result::Result<T, Error>;