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
use std::fmt;
use std::error;

#[derive(Debug)]
pub enum BrowsercookieError {
    ProfileMissing(String),
    InvalidProfile(String),
    InvalidCookieStore(String),
    InvalidRecovery(String)
}

impl fmt::Display for BrowsercookieError {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        write!(f, "Error in fetching browsercookies")
    }
}

// This is important for other errors to wrap this one.
impl error::Error for BrowsercookieError {
    fn description(&self) -> &str {
        "Error in fetching browsercookies"
    }

    fn cause(&self) -> Option<&error::Error> {
        // Generic error, underlying cause isn't tracked.
        None
    }
}