pub_just/
output_error.rs

1use super::*;
2
3#[derive(Debug)]
4pub enum OutputError {
5  /// Non-zero exit code
6  Code(i32),
7  /// IO error
8  Io(io::Error),
9  /// Terminated by signal
10  Signal(i32),
11  /// Unknown failure
12  Unknown,
13  /// Stdout not UTF-8
14  Utf8(str::Utf8Error),
15}
16
17impl Display for OutputError {
18  fn fmt(&self, f: &mut Formatter) -> fmt::Result {
19    match *self {
20      Self::Code(code) => write!(f, "Process exited with status code {code}"),
21      Self::Io(ref io_error) => write!(f, "Error executing process: {io_error}"),
22      Self::Signal(signal) => write!(f, "Process terminated by signal {signal}"),
23      Self::Unknown => write!(f, "Process experienced an unknown failure"),
24      Self::Utf8(ref err) => write!(f, "Could not convert process stdout to UTF-8: {err}"),
25    }
26  }
27}