aur_depends/
error.rs

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
use std::fmt::{self, Display};

/// The error type for aur-depends.
#[derive(Debug)]
pub enum Error {
    /// An error occurred in the alpm crate.
    Alpm(alpm::Error),
    /// An error occurred in the rua crate.
    Raur(Box<dyn std::error::Error + Send + Sync>),
}

impl From<alpm::Error> for Error {
    fn from(e: alpm::Error) -> Error {
        Error::Alpm(e)
    }
}

impl Display for Error {
    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
        match self {
            Error::Alpm(e) => e.fmt(fmt),
            Error::Raur(e) => e.fmt(fmt),
        }
    }
}

impl std::error::Error for Error {}