lib_migrations_sql/error.rs
1use thiserror::Error;
2
3pub type Result<T> = std::result::Result<T, Error>;
4
5#[derive(Error, Debug)]
6pub enum Error {
7 #[error("SQL execution failed: {0}")]
8 Sql(String),
9
10 #[error("Migration error: {0}")]
11 Migration(#[from] lib_migrations_core::Error),
12
13 #[cfg(feature = "sqlite")]
14 #[error("SQLite error: {0}")]
15 Sqlite(#[from] rusqlite::Error),
16}
17
18impl Error {
19 pub fn sql(msg: impl Into<String>) -> Self {
20 Self::Sql(msg.into())
21 }
22}