rust_sql_organizer/searcher/
error.rs

1use std::fmt::Display;
2
3#[derive(Debug)]
4#[non_exhaustive]
5pub enum Error {
6    EmptyFileExtension,
7    GlobPatternError(glob::PatternError),
8    GlobError(glob::GlobError),
9}
10
11impl From<glob::GlobError> for Error {
12    fn from(value: glob::GlobError) -> Self {
13        Self::GlobError(value)
14    }
15}
16
17impl From<glob::PatternError> for Error {
18    fn from(value: glob::PatternError) -> Self {
19        Self::GlobPatternError(value)
20    }
21}
22
23impl Display for Error {
24    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
25        match self {
26            Self::EmptyFileExtension => f.write_str("Extension is empty"),
27            Self::GlobPatternError(e) => e.fmt(f),
28            Self::GlobError(e) => e.fmt(f),
29        }
30    }
31}
32
33impl std::error::Error for Error {}