diff options
author | Teddy Wing | 2022-03-13 03:29:00 +0100 |
---|---|---|
committer | Teddy Wing | 2022-03-13 03:29:00 +0100 |
commit | 2acd2e9876bb6450db0f3b3713b975311c0f5322 (patch) | |
tree | 8ced1e2f7c5054c1e9969ee3af2a527cdc38b2bf /src/sqlite.rs | |
parent | cb3ab314425b29aa881597796d2c7deecfba025c (diff) | |
download | yaqlite-2acd2e9876bb6450db0f3b3713b975311c0f5322.tar.bz2 |
insert(): Remove `unwrap()`s
Use a new `yaqlite::Error` type. Remove the other error types and use
this main error type everywhere. For now, that seems simpler.
The real reason why I centralised on one error type is that I wanted a
single `Error::Sqlite` variant for both `rusqlite::Error` and
`SqliteError` errors. However, I wasn't sure if it's possible to do that
with `thiserror`, and I didn't want to bother having to write my own
`std::error::Error` impls.
Diffstat (limited to 'src/sqlite.rs')
-rw-r--r-- | src/sqlite.rs | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/src/sqlite.rs b/src/sqlite.rs index 1e3aeec..ba3c19d 100644 --- a/src/sqlite.rs +++ b/src/sqlite.rs @@ -1,16 +1,8 @@ use rusqlite; -use thiserror; use std::collections::HashMap; -#[derive(thiserror::Error, Debug)] -pub enum SqliteError { - #[error("SQL error")] - Sqlite(#[from] rusqlite::Error), -} - - /// Get the fundamental SQLite datatype for a given type name. /// /// Use the SQLite rules for type affinity described in: @@ -51,7 +43,7 @@ pub struct Zero; pub fn get_column_names( dbconn: &rusqlite::Connection, table_name: &str, -) -> Result<HashMap<String, Zero>, SqliteError> { +) -> Result<HashMap<String, Zero>, crate::Error> { let mut column_names = HashMap::new(); let mut stmt = dbconn.prepare( |