From 6eb0981829ec64e0b3a2fffcf61f950638955eca Mon Sep 17 00:00:00 2001 From: "hinto.janai" Date: Tue, 13 Feb 2024 17:34:44 -0500 Subject: [PATCH] error: remove `` generic we can just map each backend error variant <-> our error as needed --- database/src/error.rs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/database/src/error.rs b/database/src/error.rs index 54f32ac7..c2a4d138 100644 --- a/database/src/error.rs +++ b/database/src/error.rs @@ -14,15 +14,11 @@ use crate::constants::DATABASE_BACKEND; /// be needed if we can convert all error types into /// "generic" database errors. #[derive(thiserror::Error, Debug)] -pub enum InitError { +pub enum InitError { /// TODO #[error("database PATH is inaccessible: {0}")] Path(std::io::Error), - /// TODO - #[error("{DATABASE_BACKEND} error: {0}")] - Backend(BackendError), - /// TODO /// /// An unknown error occurred. @@ -46,8 +42,8 @@ pub enum InitError { feature = "borsh", derive(borsh::BorshSerialize, borsh::BorshDeserialize) )] -#[derive(thiserror::Error, Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)] -pub enum RuntimeError { +#[derive(thiserror::Error, Debug)] +pub enum RuntimeError { /// The given key already existed in the database. /// /// The string inside is the output of @@ -83,7 +79,9 @@ pub enum RuntimeError { /// The expected database version was not the version found. #[error("database version mismatch: expected {expected}, found {found}")] VersionMismatch { + /// The expected database version. expected: &'static str, + /// The database version found. found: &'static str, }, @@ -94,10 +92,6 @@ pub enum RuntimeError { #[error("database maximum parallel readers reached")] MaxReaders, - /// An unknown backend-specific error occured. - #[error("{DATABASE_BACKEND} error: {0}")] - Backend(BackendError), - // TODO: this could be removed once we have all errors figured out. /// An unknown error occurred. #[error("unknown error: {0}")]