diff options
author | Nayeem Rahman <nayeemrmn99@gmail.com> | 2023-04-28 14:21:55 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-28 15:21:55 +0200 |
commit | 0b296c6378c46c18de7c3838b2a3e1d13eb9bd87 (patch) | |
tree | 19e2e9697ccda1808997bede87493dc0f257a8a2 /cli/tools/repl/mod.rs | |
parent | 84b921555fa481a0a2c4cffe5c897fd1c87485b7 (diff) |
fix(repl): don't panic on undefined exception (#18888)
Fixes regression from #18878 where `Promise.reject()`,
`Promise.reject(undefined)` and `reportError(undefined)` panic in the
REPL.
Fixes `throw undefined` printing `Uncaught Unknown exception` instead of
`Uncaught undefined`.
Diffstat (limited to 'cli/tools/repl/mod.rs')
-rw-r--r-- | cli/tools/repl/mod.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/cli/tools/repl/mod.rs b/cli/tools/repl/mod.rs index 0a6d9b9e9..59b79ce86 100644 --- a/cli/tools/repl/mod.rs +++ b/cli/tools/repl/mod.rs @@ -70,7 +70,7 @@ async fn read_line_and_poll( let exception_details = params.get("exceptionDetails").unwrap().as_object().unwrap(); let text = exception_details.get("text").unwrap().as_str().unwrap(); let exception = exception_details.get("exception").unwrap().as_object().unwrap(); - let description = exception.get("description").unwrap().as_str().unwrap(); + let description = exception.get("description").and_then(|d| d.as_str()).unwrap_or("undefined"); println!("{text} {description}"); } } |