1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
use displaydoc::Display;
use thiserror::Error;

/// Proof-of-Stake result
pub type PosResult<T, E = PosError> = core::result::Result<T, E>;

/// Proof-of-Stake error
#[non_exhaustive]
#[derive(Display, Error, Debug, Clone)]
pub enum PosError {
    /// Container inconsistency: {0}
    ContainerInconsistency(String),
    /// Invalid roll distribution: {0}
    InvalidRollDistribution(String),
    /// Overflow error: {0}
    OverflowError(String),
    /// `CycleUnavailable`: PoS cycle {0} is needed but is absent from cache
    CycleUnavailable(u64),
    /// `CycleUnfinished`: PoS cycle {0} is needed but is not complete yet
    CycleUnfinished(u64),
    /// Error while loading initial rolls file: {0}
    RollsFileLoadingError(String),
    /// Error while loading initial deferred credits file: {0}
    DeferredCreditsFileLoadingError(String),
    /// Communication channel was down: {0}
    ChannelDown(String),
}