summaryrefslogtreecommitdiff
path: root/cli/worker.rs
diff options
context:
space:
mode:
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__");