Skip to main content

pixel_sig/
errors.rs

1/*error_chain! {
2    errors {
3        MoreThanSupported(T: u128) {
4            description("Time more than the maximum supported value")
5            display("T should be less than max value for u128 but was : {}", T)
6        }
7    }
8}*/
9
10use failure::Error;
11
12#[derive(Debug, Fail)]
13pub enum PixelError {
14    #[fail(
15        display = "T should be >= 3 and less than max value for u128 but was : {}",
16        T
17    )]
18    InvalidMaxTimePeriod { T: u128 },
19    //#[fail(display = "T+1 should be power of 2 but T was : {}", T+1)]
20    #[fail(display = "T+1 should be power of 2")]
21    NonPowerOfTwo { T: u128 },
22    #[fail(display = "Invalid path={:?} for l={}", path, l)]
23    InvalidPath { path: Vec<u8>, l: u8 },
24    #[fail(display = "Invalid node number={} for l={}", t, l)]
25    InvalidNodeNum { t: u128, l: u8 },
26    #[fail(display = "Provide at least {} generators", n)]
27    NotEnoughGenerators { n: usize },
28    #[fail(display = "Sigkey for time t={} not found", t)]
29    SigkeyNotFound { t: u128 },
30    #[fail(
31        display = "Cannot update key to previous time={}, current time={}",
32        old_t, current_t
33    )]
34    SigkeyUpdateBackward { old_t: u128, current_t: u128 },
35    #[fail(display = "Sigkey alrady updated to desired time={}", t)]
36    SigkeyAlreadyUpdated { t: u128 },
37}