c7f47af9fb
* Enable logging in tests * Migrate states to the freezer atomically
62 lines
1.3 KiB
Rust
62 lines
1.3 KiB
Rust
use crate::chunked_vector::ChunkError;
|
|
use crate::hot_cold_store::HotColdDBError;
|
|
use ssz::DecodeError;
|
|
use types::{BeaconStateError, Hash256, Slot};
|
|
|
|
pub type Result<T> = std::result::Result<T, Error>;
|
|
|
|
#[derive(Debug)]
|
|
pub enum Error {
|
|
SszDecodeError(DecodeError),
|
|
VectorChunkError(ChunkError),
|
|
BeaconStateError(BeaconStateError),
|
|
PartialBeaconStateError,
|
|
HotColdDBError(HotColdDBError),
|
|
DBError { message: String },
|
|
RlpError(String),
|
|
BlockNotFound(Hash256),
|
|
NoContinuationData,
|
|
SplitPointModified(Slot, Slot),
|
|
}
|
|
|
|
impl From<DecodeError> for Error {
|
|
fn from(e: DecodeError) -> Error {
|
|
Error::SszDecodeError(e)
|
|
}
|
|
}
|
|
|
|
impl From<ChunkError> for Error {
|
|
fn from(e: ChunkError) -> Error {
|
|
Error::VectorChunkError(e)
|
|
}
|
|
}
|
|
|
|
impl From<HotColdDBError> for Error {
|
|
fn from(e: HotColdDBError) -> Error {
|
|
Error::HotColdDBError(e)
|
|
}
|
|
}
|
|
|
|
impl From<BeaconStateError> for Error {
|
|
fn from(e: BeaconStateError) -> Error {
|
|
Error::BeaconStateError(e)
|
|
}
|
|
}
|
|
|
|
impl From<DBError> for Error {
|
|
fn from(e: DBError) -> Error {
|
|
Error::DBError { message: e.message }
|
|
}
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub struct DBError {
|
|
pub message: String,
|
|
}
|
|
|
|
impl DBError {
|
|
pub fn new(message: String) -> Self {
|
|
Self { message }
|
|
}
|
|
}
|