feat: encapsulate rusqlite::Error into sqlite::FailedTo (ExecuteBatch)
This commit is contained in:
@@ -28,6 +28,6 @@ pub fn run(path: &path::Path) -> result::Result<(), FailedTo> {
|
|||||||
let connection = Connection::open(path).map_err(|_| sqlite::FailedTo::OpenConnection)?;
|
let connection = Connection::open(path).map_err(|_| sqlite::FailedTo::OpenConnection)?;
|
||||||
connection
|
connection
|
||||||
.execute_batch(init_statement)
|
.execute_batch(init_statement)
|
||||||
.map_err(|_| sqlite::FailedTo::ExecuteBatch)?;
|
.map_err(|sqlite_error| sqlite::FailedTo::ExecuteBatch(sqlite_error))?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ pub enum FailedTo {
|
|||||||
/// Failed to commit a database transaction.
|
/// Failed to commit a database transaction.
|
||||||
CommitTransaction(rusqlite::Error),
|
CommitTransaction(rusqlite::Error),
|
||||||
/// Failed to execute a batch of SQL statements.
|
/// Failed to execute a batch of SQL statements.
|
||||||
ExecuteBatch,
|
ExecuteBatch(rusqlite::Error),
|
||||||
/// Failed to execute a SQL query.
|
/// Failed to execute a SQL query.
|
||||||
ExecuteQuery,
|
ExecuteQuery,
|
||||||
/// Failed to execute a prepared SQL statement.
|
/// Failed to execute a prepared SQL statement.
|
||||||
|
|||||||
Reference in New Issue
Block a user