diff options
author | syn <isaqtm@gmail.com> | 2020-02-09 19:17:57 +0300 |
---|---|---|
committer | syn <isaqtm@gmail.com> | 2020-02-09 19:17:57 +0300 |
commit | 30e1e3a13dc19c47afc517d1178e1dbf5b401596 (patch) | |
tree | b57b23cb10d468325bc259e05dfb6901b9b56f59 /src/backends/run_error.rs | |
parent | df090c4c8caa0632ce1fa802faf8752c2c861517 (diff) | |
download | evr-30e1e3a13dc19c47afc517d1178e1dbf5b401596.tar.gz |
timeout'ed waiter for process
Diffstat (limited to 'src/backends/run_error.rs')
-rw-r--r-- | src/backends/run_error.rs | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/backends/run_error.rs b/src/backends/run_error.rs new file mode 100644 index 0000000..68f0495 --- /dev/null +++ b/src/backends/run_error.rs @@ -0,0 +1,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) + } + } +}
\ No newline at end of file |