Sergio Chouhy 50be74580b refactor!: move LEZ related crates to dedicated directory
BREAKING CHANGE: LEZ crates have been moved from top-level directories into
  a dedicated `lez/` subdirectory. The following crates were relocated:

    common          → lez/common
    indexer         → lez/indexer
    explorer_service→ lez/explorer_service
    keycard_wallet  → lez/keycard_wallet
    mempool         → lez/mempool
    sequencer       → lez/sequencer
    storage         → lez/storage
    testnet_initial_state → lez/testnet_initial_state
    wallet          → lez/wallet
    wallet-ffi      → lez/wallet-ffi

  Any external tooling, scripts, or paths referencing these crates at their
  previous top-level locations must be updated.
2026-06-02 14:17:59 -03:00

43 lines
1.2 KiB
Rust

#[derive(thiserror::Error, Debug)]
pub enum DbError {
#[error("RocksDb error: {}", additional_info.as_deref().unwrap_or("No additional info"))]
RocksDbError {
#[source]
error: rocksdb::Error,
additional_info: Option<String>,
},
#[error("Serialization error: {}", additional_info.as_deref().unwrap_or("No additional info"))]
SerializationError {
#[source]
error: borsh::io::Error,
additional_info: Option<String>,
},
#[error("Logic Error: {additional_info}")]
DbInteractionError { additional_info: String },
}
impl DbError {
#[must_use]
pub const fn rocksdb_cast_message(rerr: rocksdb::Error, message: Option<String>) -> Self {
Self::RocksDbError {
error: rerr,
additional_info: message,
}
}
#[must_use]
pub const fn borsh_cast_message(berr: borsh::io::Error, message: Option<String>) -> Self {
Self::SerializationError {
error: berr,
additional_info: message,
}
}
#[must_use]
pub const fn db_interaction_error(message: String) -> Self {
Self::DbInteractionError {
additional_info: message,
}
}
}