1use abscissa_core::err;
4use failure::Fail;
5use std::{fmt, io};
6
7#[derive(Debug)]
9pub struct Error(abscissa_core::Error<ErrorKind>);
10
11#[derive(Copy, Clone, Eq, PartialEq, Debug, Fail)]
13pub enum ErrorKind {
14 #[fail(display = "config error")]
16 Config,
17
18 #[fail(display = "I/O error")]
20 Io,
21}
22
23impl fmt::Display for Error {
24 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
25 self.0.fmt(f)
26 }
27}
28
29impl From<abscissa_core::Error<ErrorKind>> for Error {
30 fn from(other: abscissa_core::Error<ErrorKind>) -> Self {
31 Error(other)
32 }
33}
34
35impl From<io::Error> for Error {
36 fn from(other: io::Error) -> Self {
37 err!(ErrorKind::Io, other).into()
38 }
39}