block_db/
error.rs

1// Authors: Robert Lopez
2
3use crate::uncorrupt::UncorruptAction;
4use thiserror::Error;
5
6/// Represents any Error that can occur in this crate.
7#[derive(Error, Debug)]
8pub enum Error {
9    #[error("{0}")]
10    IO(#[from] std::io::Error),
11    #[error("{0}")]
12    Walr(#[from] walr::error::Error),
13    #[error("{0}")]
14    SerdeJson(#[from] serde_json::Error),
15    #[error("{0}")]
16    Internal(String),
17    #[error("{0}")]
18    InvalidID(String),
19    #[error("{0}")]
20    InvalidOption(String),
21    #[error("BlockDB is corrupted! Please ensure FS stability, then call `BlockDB::uncorrupt(err.action)`")]
22    Corrupted {
23        err: Box<Error>,
24        action: UncorruptAction,
25    },
26}