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
28
29
30
31
32
33
34
use std::error;
use std::fmt;
use crate::enums;
#[derive(Debug)]
pub struct AlpmError {
error_no: enums::ErrorNo,
}
impl AlpmError{
pub fn new(error_no: enums::ErrorNo) -> AlpmError{
AlpmError{
error_no: error_no,
}
}
}
impl fmt::Display for AlpmError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "alpm_error({})", self.error_no as i32)
}
}
impl error::Error for AlpmError {
fn description(&self) -> &str {
"Alpm error."
}
fn cause(&self) -> Option<&error::Error> {
None
}
}