mirror of
https://github.com/Cuprate/cuprate.git
synced 2024-12-23 12:09:52 +00:00
error: remove <BackendError>
generic
we can just map each backend error variant <-> our error as needed
This commit is contained in:
parent
4a13dc22e8
commit
6eb0981829
1 changed files with 5 additions and 11 deletions
|
@ -14,15 +14,11 @@ use crate::constants::DATABASE_BACKEND;
|
||||||
/// be needed if we can convert all error types into
|
/// be needed if we can convert all error types into
|
||||||
/// "generic" database errors.
|
/// "generic" database errors.
|
||||||
#[derive(thiserror::Error, Debug)]
|
#[derive(thiserror::Error, Debug)]
|
||||||
pub enum InitError<BackendError: Debug> {
|
pub enum InitError {
|
||||||
/// TODO
|
/// TODO
|
||||||
#[error("database PATH is inaccessible: {0}")]
|
#[error("database PATH is inaccessible: {0}")]
|
||||||
Path(std::io::Error),
|
Path(std::io::Error),
|
||||||
|
|
||||||
/// TODO
|
|
||||||
#[error("{DATABASE_BACKEND} error: {0}")]
|
|
||||||
Backend(BackendError),
|
|
||||||
|
|
||||||
/// TODO
|
/// TODO
|
||||||
///
|
///
|
||||||
/// An unknown error occurred.
|
/// An unknown error occurred.
|
||||||
|
@ -46,8 +42,8 @@ pub enum InitError<BackendError: Debug> {
|
||||||
feature = "borsh",
|
feature = "borsh",
|
||||||
derive(borsh::BorshSerialize, borsh::BorshDeserialize)
|
derive(borsh::BorshSerialize, borsh::BorshDeserialize)
|
||||||
)]
|
)]
|
||||||
#[derive(thiserror::Error, Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
|
#[derive(thiserror::Error, Debug)]
|
||||||
pub enum RuntimeError<BackendError: Debug> {
|
pub enum RuntimeError {
|
||||||
/// The given key already existed in the database.
|
/// The given key already existed in the database.
|
||||||
///
|
///
|
||||||
/// The string inside is the output of
|
/// 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.
|
/// The expected database version was not the version found.
|
||||||
#[error("database version mismatch: expected {expected}, found {found}")]
|
#[error("database version mismatch: expected {expected}, found {found}")]
|
||||||
VersionMismatch {
|
VersionMismatch {
|
||||||
|
/// The expected database version.
|
||||||
expected: &'static str,
|
expected: &'static str,
|
||||||
|
/// The database version found.
|
||||||
found: &'static str,
|
found: &'static str,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -94,10 +92,6 @@ pub enum RuntimeError<BackendError: Debug> {
|
||||||
#[error("database maximum parallel readers reached")]
|
#[error("database maximum parallel readers reached")]
|
||||||
MaxReaders,
|
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.
|
// TODO: this could be removed once we have all errors figured out.
|
||||||
/// An unknown error occurred.
|
/// An unknown error occurred.
|
||||||
#[error("unknown error: {0}")]
|
#[error("unknown error: {0}")]
|
||||||
|
|
Loading…
Reference in a new issue