summaryrefslogtreecommitdiff
path: root/src/error.rs
blob: 370bb2f36b681df448bed0159da23a2b63fa8102 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
use std::error::Error;
use std::fmt;

#[derive(Debug)]
pub struct CapnError {
    pub reason: String,
}

impl CapnError {
    pub fn new(reason: String) -> CapnError {
        CapnError { reason }
    }
}

impl fmt::Display for CapnError {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        write!(f, "{}", self.reason)
    }
}

impl Error for CapnError {}