From 2acd2e9876bb6450db0f3b3713b975311c0f5322 Mon Sep 17 00:00:00 2001 From: Teddy Wing Date: Sun, 13 Mar 2022 03:29:00 +0100 Subject: 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. --- src/sqlite.rs | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'src/sqlite.rs') 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, SqliteError> { +) -> Result, crate::Error> { let mut column_names = HashMap::new(); let mut stmt = dbconn.prepare( -- cgit v1.2.3