Files
reth/crates/interfaces/src/db.rs
Georgios Konstantopoulos 08900740bc feat: Better progress reporting for stage checkpoints (#2982)
Co-authored-by: Alexey Shekhirin <a.shekhirin@gmail.com>
2023-06-05 16:10:46 +00:00

35 lines
1.3 KiB
Rust

/// Database error type. They are using u32 to represent error code.
#[derive(Debug, thiserror::Error, PartialEq, Eq, Clone)]
pub enum DatabaseError {
/// Failed to open database.
#[error("Failed to open database: {0:?}")]
FailedToOpen(i32),
/// Failed to create a table in database.
#[error("Table Creating error code: {0:?}")]
TableCreation(i32),
/// Failed to insert a value into a table.
#[error("Database write error code: {0:?}")]
Write(i32),
/// Failed to get a value into a table.
#[error("Database read error code: {0:?}")]
Read(i32),
/// Failed to delete a `(key, value)` pair into a table.
#[error("Database delete error code: {0:?}")]
Delete(i32),
/// Failed to commit transaction changes into the database.
#[error("Database commit error code: {0:?}")]
Commit(i32),
/// Failed to initiate a transaction.
#[error("Initialization of transaction errored with code: {0:?}")]
InitTransaction(i32),
/// Failed to initiate a cursor.
#[error("Initialization of cursor errored with code: {0:?}")]
InitCursor(i32),
/// Failed to decode a key from a table.
#[error("Error decoding value.")]
DecodeError,
/// Failed to get database stats.
#[error("Database stats error code: {0:?}")]
Stats(i32),
}