mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-18 12:22:51 +00:00
Add beacon.watch (#3362)
> 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.
This commit is contained in:
55
watch/src/database/error.rs
Normal file
55
watch/src/database/error.rs
Normal file
@@ -0,0 +1,55 @@
|
||||
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)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user