equal
deleted
inserted
replaced
10 pub enum CommandErrorKind { |
10 pub enum CommandErrorKind { |
11 /// The root of the repository cannot be found |
11 /// The root of the repository cannot be found |
12 RootNotFound(PathBuf), |
12 RootNotFound(PathBuf), |
13 /// The current directory cannot be found |
13 /// The current directory cannot be found |
14 CurrentDirNotFound(std::io::Error), |
14 CurrentDirNotFound(std::io::Error), |
|
15 /// Error while reading or writing a file |
|
16 // TODO: add the file name/path? |
|
17 FileError(std::io::Error), |
15 /// The standard output stream cannot be written to |
18 /// The standard output stream cannot be written to |
16 StdoutError, |
19 StdoutError, |
17 /// The standard error stream cannot be written to |
20 /// The standard error stream cannot be written to |
18 StderrError, |
21 StderrError, |
19 /// The command aborted |
22 /// The command aborted |
25 impl CommandErrorKind { |
28 impl CommandErrorKind { |
26 pub fn get_exit_code(&self) -> exitcode::ExitCode { |
29 pub fn get_exit_code(&self) -> exitcode::ExitCode { |
27 match self { |
30 match self { |
28 CommandErrorKind::RootNotFound(_) => exitcode::ABORT, |
31 CommandErrorKind::RootNotFound(_) => exitcode::ABORT, |
29 CommandErrorKind::CurrentDirNotFound(_) => exitcode::ABORT, |
32 CommandErrorKind::CurrentDirNotFound(_) => exitcode::ABORT, |
|
33 CommandErrorKind::FileError(_) => exitcode::ABORT, |
30 CommandErrorKind::StdoutError => exitcode::ABORT, |
34 CommandErrorKind::StdoutError => exitcode::ABORT, |
31 CommandErrorKind::StderrError => exitcode::ABORT, |
35 CommandErrorKind::StderrError => exitcode::ABORT, |
32 CommandErrorKind::Abort(_) => exitcode::ABORT, |
36 CommandErrorKind::Abort(_) => exitcode::ABORT, |
33 CommandErrorKind::Unimplemented => exitcode::UNIMPLEMENTED_COMMAND, |
37 CommandErrorKind::Unimplemented => exitcode::UNIMPLEMENTED_COMMAND, |
34 } |
38 } |