diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2020-09-09 22:40:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-09 22:40:16 +0200 |
commit | 2423a867c0540edc5535a21559e6319d920e1376 (patch) | |
tree | 3c476cc0a084e34cea3a87db429f176fcd1d0506 /cli/errors.rs | |
parent | 839c59b14f062649ebfad702658b271830dcbb50 (diff) |
fix: panic on process.kill() after run (#7405)
This commit fixes panic caused by "unimplemented!()"
calls for some variants of "nix::errno::Errno".
Catch-all variant now returns "Error" class name
instead of panicking.
Co-authored-by: Bert Belder <bertbelder@gmail.com>
Diffstat (limited to 'cli/errors.rs')
-rw-r--r-- | cli/errors.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cli/errors.rs b/cli/errors.rs index ffa0b95e4..041e8703c 100644 --- a/cli/errors.rs +++ b/cli/errors.rs @@ -156,12 +156,14 @@ fn get_url_parse_error_class(_error: &url::ParseError) -> &'static str { fn get_nix_error_class(error: &nix::Error) -> &'static str { use nix::errno::Errno::*; match error { - nix::Error::Sys(EPERM) => "PermissionDenied", + nix::Error::Sys(ECHILD) => "NotFound", nix::Error::Sys(EINVAL) => "TypeError", nix::Error::Sys(ENOENT) => "NotFound", nix::Error::Sys(ENOTTY) => "BadResource", - nix::Error::Sys(UnknownErrno) => unreachable!(), - nix::Error::Sys(_) => unreachable!(), + nix::Error::Sys(EPERM) => "PermissionDenied", + nix::Error::Sys(ESRCH) => "NotFound", + nix::Error::Sys(UnknownErrno) => "Error", + nix::Error::Sys(_) => "Error", nix::Error::InvalidPath => "TypeError", nix::Error::InvalidUtf8 => "InvalidData", nix::Error::UnsupportedOperation => unreachable!(), |