summaryrefslogtreecommitdiff
path: root/cli/worker.rs
diff options
context:
space:
mode:
authorKevin (Kun) "Kassimo" Qian <kevinkassimo@gmail.com>2019-12-19 21:04:14 -0800
committerRy Dahl <ry@tinyclouds.org>2019-12-20 00:04:14 -0500
commit9ef0b18eb0b4c337ccfc8d0add36bec6b657262f (patch)
tree62bc08da0245b8fd7f350480c3ad94319457a7be /cli/worker.rs
parentfcae4a7c0dc74701f3b1919bfd76cfdc1a0321ed (diff)
repl: do not crash on async op reject (#3527)
Diffstat (limited to 'cli/worker.rs')
-rw-r--r--cli/worker.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/cli/worker.rs b/cli/worker.rs
index 814e7f440..e35458d39 100644
--- a/cli/worker.rs
+++ b/cli/worker.rs
@@ -96,6 +96,14 @@ impl Worker {
}
}
+ pub fn set_error_handler(
+ &mut self,
+ handler: Box<dyn FnMut(ErrBox) -> Result<(), ErrBox>>,
+ ) {
+ let mut i = self.isolate.lock().unwrap();
+ i.set_error_handler(handler);
+ }
+
/// Same as execute2() but the filename defaults to "$CWD/__anonymous__".
pub fn execute(&mut self, js_source: &str) -> Result<(), ErrBox> {
let path = env::current_dir().unwrap().join("__anonymous__");