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
use sysfs_pwm;
use diesel;

// Define the errors for this crate.
error_chain! {
    types {
        Error, ErrorKind, ResultExt, Result;
    }

    links {}

    foreign_links {
        PwmError(sysfs_pwm::Error) #[doc = "PwmError"];
        DatabaseError(diesel::result::Error);
    }

    errors {
        /// Target flow rate was out of range
        TargetFlowRateOutOfRange {
            description("The target flow rate is out of range")
            display("The target flow rate is out of range.")

        }

        /// Not enough liquid
        NotEnoughLiquid(level: f64) {
            description("There is not enough liquid in the current dispense")
            display("There is currently {} mL left in the dispenser, this is not enough.", level)
        }
    }
}