error: remove <BackendError> generic

we can just map each backend error variant <-> our error as needed
This commit is contained in:
hinto.janai 2024-02-13 17:34:44 -05:00
parent 4a13dc22e8
commit 6eb0981829
No known key found for this signature in database
GPG key ID: D47CE05FA175A499

View file

@ -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<BackendError: Debug> {
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<BackendError: Debug> {
feature = "borsh",
derive(borsh::BorshSerialize, borsh::BorshDeserialize)
)]
#[derive(thiserror::Error, Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
pub enum RuntimeError<BackendError: Debug> {
#[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<BackendError: Debug> {
/// 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<BackendError: Debug> {
#[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}")]