From 9ef0b18eb0b4c337ccfc8d0add36bec6b657262f Mon Sep 17 00:00:00 2001 From: "Kevin (Kun) \"Kassimo\" Qian" Date: Thu, 19 Dec 2019 21:04:14 -0800 Subject: repl: do not crash on async op reject (#3527) --- cli/worker.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cli/worker.rs') 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 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__"); -- cgit v1.2.3