summaryrefslogtreecommitdiff
path: root/core/error.rs
diff options
context:
space:
mode:
authorNayeem Rahman <nayeemrmn99@gmail.com>2021-01-21 09:48:04 +0000
committerGitHub <noreply@github.com>2021-01-21 20:48:04 +1100
commitbdb1ee64800e03699d41265c5158c99e3a390ec7 (patch)
tree28fdf0820530f447167cdad230d72c2b43d18541 /core/error.rs
parent18ac7d40c87b380ce5ed617bd7c59e344730a883 (diff)
fix(core): Handle prepareStackTrace() throws (#9211)
Fixes #9206
Diffstat (limited to 'core/error.rs')
-rw-r--r--core/error.rs6
1 files changed, 2 insertions, 4 deletions
diff --git a/core/error.rs b/core/error.rs
index db5c8afd6..b68c9df8c 100644
--- a/core/error.rs
+++ b/core/error.rs
@@ -193,11 +193,9 @@ impl JsError {
// Access error.stack to ensure that prepareStackTrace() has been called.
// This should populate error.__callSiteEvals.
+ let stack = get_property(scope, exception, "stack");
let stack: Option<v8::Local<v8::String>> =
- get_property(scope, exception, "stack")
- .unwrap()
- .try_into()
- .ok();
+ stack.and_then(|s| s.try_into().ok());
let stack = stack.map(|s| s.to_rust_string_lossy(scope));
// Read an array of structured frames from error.__callSiteEvals.