mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 18:21:45 +00:00
> This is currently a WIP and all features are subject to alteration or removal at any time. ## Overview The successor to #2873. Contains the backbone of `beacon.watch` including syncing code, the initial API, and several core database tables. See `watch/README.md` for more information, requirements and usage.
56 lines
1.1 KiB
Rust
56 lines
1.1 KiB
Rust
use bls::Error as BlsError;
|
|
use diesel::result::{ConnectionError, Error as PgError};
|
|
use eth2::SensitiveError;
|
|
use r2d2::Error as PoolError;
|
|
use std::fmt;
|
|
use types::BeaconStateError;
|
|
|
|
#[derive(Debug)]
|
|
pub enum Error {
|
|
BeaconState(BeaconStateError),
|
|
Database(PgError),
|
|
DatabaseCorrupted,
|
|
InvalidSig(BlsError),
|
|
PostgresConnection(ConnectionError),
|
|
Pool(PoolError),
|
|
SensitiveUrl(SensitiveError),
|
|
InvalidRoot,
|
|
Other(String),
|
|
}
|
|
|
|
impl fmt::Display for Error {
|
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
|
write!(f, "{:?}", self)
|
|
}
|
|
}
|
|
|
|
impl From<BeaconStateError> for Error {
|
|
fn from(e: BeaconStateError) -> Self {
|
|
Error::BeaconState(e)
|
|
}
|
|
}
|
|
|
|
impl From<ConnectionError> for Error {
|
|
fn from(e: ConnectionError) -> Self {
|
|
Error::PostgresConnection(e)
|
|
}
|
|
}
|
|
|
|
impl From<PgError> for Error {
|
|
fn from(e: PgError) -> Self {
|
|
Error::Database(e)
|
|
}
|
|
}
|
|
|
|
impl From<PoolError> for Error {
|
|
fn from(e: PoolError) -> Self {
|
|
Error::Pool(e)
|
|
}
|
|
}
|
|
|
|
impl From<BlsError> for Error {
|
|
fn from(e: BlsError) -> Self {
|
|
Error::InvalidSig(e)
|
|
}
|
|
}
|