aur_depends/
error.rs

1use std::fmt::{self, Display};
2
3/// The error type for aur-depends.
4#[derive(Debug)]
5pub enum Error {
6    /// An error occurred in the alpm crate.
7    Alpm(alpm::Error),
8    /// An error occurred in the rua crate.
9    Raur(Box<dyn std::error::Error + Send + Sync>),
10}
11
12impl From<alpm::Error> for Error {
13    fn from(e: alpm::Error) -> Error {
14        Error::Alpm(e)
15    }
16}
17
18impl Display for Error {
19    fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
20        match self {
21            Error::Alpm(e) => e.fmt(fmt),
22            Error::Raur(e) => e.fmt(fmt),
23        }
24    }
25}
26
27impl std::error::Error for Error {}