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/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'cli/lib.rs') diff --git a/cli/lib.rs b/cli/lib.rs index df4cbbdf0..b191d5e87 100644 --- a/cli/lib.rs +++ b/cli/lib.rs @@ -349,6 +349,11 @@ fn bundle_command(flags: DenoFlags) { fn run_repl(flags: DenoFlags) { let (mut worker, _state) = create_worker_and_state(flags); + // Make repl continue to function under uncaught async errors. + worker.set_error_handler(Box::new(|err| { + eprintln!("{}", err.to_string()); + Ok(()) + })); // Setup runtime. js_check(worker.execute("denoMain()")); let main_future = async move { -- cgit v1.2.3