ump_ng_autopost/
err.rs

1use std::{fmt, io};
2
3#[derive(Debug)]
4pub enum Error {
5  IO(std::io::Error),
6  NotRunning,
7  ClientDisappeared,
8  ServerDisappeared
9}
10
11impl std::error::Error for Error {}
12
13impl From<io::Error> for Error {
14  fn from(err: io::Error) -> Self {
15    Self::IO(err)
16  }
17}
18
19impl fmt::Display for Error {
20  fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
21    match self {
22      Self::IO(e) => write!(f, "I/O; {e}"),
23      Self::NotRunning => write!(f, "No longer running"),
24      Self::ClientDisappeared => write!(f, "Client disappeared"),
25      Self::ServerDisappeared => write!(f, "Server disappeared")
26    }
27  }
28}
29
30// vim: set ft=rust et sw=2 ts=2 sts=2 cinoptions=2 tw=79 :