browsercookie/
errors.rs

1//! Exported errors if library users wish to handle certain failure cases
2use std::fmt;
3use std::error;
4
5#[derive(Debug)]
6pub enum BrowsercookieError {
7    ProfileMissing(String),
8    InvalidProfile(String),
9    InvalidCookieStore(String),
10    InvalidRecovery(String)
11}
12
13impl fmt::Display for BrowsercookieError {
14    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
15        write!(f, "Error in fetching browsercookies")
16    }
17}
18
19// This is important for other errors to wrap this one.
20impl error::Error for BrowsercookieError {
21    fn description(&self) -> &str {
22        "Error in fetching browsercookies"
23    }
24
25    fn cause(&self) -> Option<&error::Error> {
26        // Generic error, underlying cause isn't tracked.
27        None
28    }
29}