summaryrefslogtreecommitdiffstats
path: root/src/error.rs
blob: 4d4a0afb981e31a3c220396eae51e137d27b5d4d (plain)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use timetype::TimeType;

error_chain! {
    types {
        KairosError, KairosErrorKind, ResultExt, Result;
    }

    links {
    }

    foreign_links {
    }

    errors {

        UnknownError {
            description("Unknown Error")
            display("Unknown Error")
        }

        CannotAdd(a: TimeType, b: TimeType) {
            description("Cannot add")
            display("Cannot add: {:?} + {:?}", a, b)
        }

        CannotSub(a: TimeType, b: TimeType) {
            description("Cannot subtract")
            display("Cannot subtract: {:?} - {:?}", a, b)
        }

        ArgumentErrorNotAnAmount(tt: TimeType) {
            description("Argument Error: Not an amount TimeType object")
            display("The passed argument is not an amount: {:?}", tt)
        }

        CannotCalculateEndOfYearOn(tt: TimeType) {
            description("Argument Error: Cannot calculate end-of-year")
            display("Argument Error: Cannot calculate end-of-year on a {:?}", tt)
        }

        CannotCalculateEndOfMonthOn(tt: TimeType) {
            description("Argument Error: Cannot calculate end-of-month")
            display("Argument Error: Cannot calculate end-of-month on a {:?}", tt)
        }

    }

}