blob: 68f049507f2581e3166bb3d93e558a2f93f25ef3 (
plain) (
blame)
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
35
36
37
38
|
use crate::wait::WaitError;
use std::io::Error as IoError;
#[derive(Debug)]
pub enum RunError {
IoError(std::io::Error),
WaitError(WaitError)
}
impl From<IoError> for RunError {
fn from(err: IoError) -> Self {
RunError::IoError(err)
}
}
impl From<WaitError> for RunError {
fn from(err: WaitError) -> Self {
RunError::WaitError(err)
}
}
impl std::fmt::Display for RunError {
fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
match &*self {
RunError::IoError(e) => e.fmt(f),
RunError::WaitError(e) => e.fmt(f)
}
}
}
impl std::error::Error for RunError {
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
match *self {
RunError::IoError(ref e) => Some(e),
RunError::WaitError(ref e) => Some(e)
}
}
}
|