aboutsummaryrefslogtreecommitdiffstats
path: root/src/yaml.rs
diff options
context:
space:
mode:
authorTeddy Wing2022-03-13 03:29:00 +0100
committerTeddy Wing2022-03-13 03:29:00 +0100
commit2acd2e9876bb6450db0f3b3713b975311c0f5322 (patch)
tree8ced1e2f7c5054c1e9969ee3af2a527cdc38b2bf /src/yaml.rs
parentcb3ab314425b29aa881597796d2c7deecfba025c (diff)
downloadyaqlite-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/yaml.rs')
-rw-r--r--src/yaml.rs9
1 files changed, 1 insertions, 8 deletions
diff --git a/src/yaml.rs b/src/yaml.rs
index b7cecad..0acaf59 100644
--- a/src/yaml.rs
+++ b/src/yaml.rs
@@ -9,13 +9,6 @@ mod sql;
pub use sql::*;
-#[derive(thiserror::Error, Debug)]
-pub enum YamlError {
- #[error("SQL error")]
- Sqlite(#[from] rusqlite::Error),
-}
-
-
// TODO: Separate functions to get a list of YAML hashes, and insert hashes into
// the database.
pub fn extract(
@@ -23,7 +16,7 @@ pub fn extract(
tx: &rusqlite::Transaction,
table_name: &str,
table_columns: &HashMap<String, crate::sqlite::Zero>,
-) -> Result<(), YamlError> {
+) -> Result<(), crate::Error> {
match doc {
yaml::Yaml::Array(ref mut array) => {
for yaml_value in array {