hambands/errors/
search_error.rs

1use std::error::Error;
2use std::fmt;
3
4#[derive(Debug)]
5pub struct SearchError {
6    details: String,
7}
8
9impl SearchError {
10    pub fn new(details: &str) -> SearchError {
11        SearchError {
12            details: details.to_string(),
13        }
14    }
15}
16
17impl fmt::Display for SearchError {
18    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
19        write!(f, "{}", self.details)
20    }
21}
22
23impl Error for SearchError {
24    fn description(&self) -> &str {
25        &self.details
26    }
27}