summaryrefslogtreecommitdiff
path: root/cli/signal.rs
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-02-23 14:51:29 -0500
committerGitHub <noreply@github.com>2020-02-23 14:51:29 -0500
commit4e1abb4f3a1fbdac25b1e7db0588572e4d5a6579 (patch)
tree644ace7dc1acac7b09bfab037e0ca589fa11987b /cli/signal.rs
parent45eb2f9b37c2c7498c58eb45f76667aaa4a7d731 (diff)
refactor: use OpError instead of ErrBox for errors in ops (#4058)
To better reflect changes in error types in JS from #3662 this PR changes default error type used in ops from "ErrBox" to "OpError". "OpError" is a type that can be sent over to JSON; it has all information needed to construct error in JavaScript. That made "GetErrorKind" trait useless and so it was removed altogether. To provide compatibility with previous use of "ErrBox" an implementation of "From<ErrBox> for OpError" was added, however, it is an escape hatch and ops implementors should strive to use "OpError" directly.
Diffstat (limited to 'cli/signal.rs')
-rw-r--r--cli/signal.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/cli/signal.rs b/cli/signal.rs
index 6f150aeab..d7e9985b5 100644
--- a/cli/signal.rs
+++ b/cli/signal.rs
@@ -1,16 +1,16 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
-use deno_core::ErrBox;
+use crate::op_error::OpError;
#[cfg(unix)]
-pub fn kill(pid: i32, signo: i32) -> Result<(), ErrBox> {
+pub fn kill(pid: i32, signo: i32) -> Result<(), OpError> {
use nix::sys::signal::{kill as unix_kill, Signal};
use nix::unistd::Pid;
let sig = Signal::from_c_int(signo)?;
- unix_kill(Pid::from_raw(pid), Option::Some(sig)).map_err(ErrBox::from)
+ unix_kill(Pid::from_raw(pid), Option::Some(sig)).map_err(OpError::from)
}
#[cfg(not(unix))]
-pub fn kill(_pid: i32, _signal: i32) -> Result<(), ErrBox> {
+pub fn kill(_pid: i32, _signal: i32) -> Result<(), OpError> {
// NOOP
// TODO: implement this for windows
Ok(())