Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(core): decode JsStackFrames using serde_v8 #9902

Merged
merged 5 commits into from
Mar 27, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
restore filter of non-array values for error.__callSiteEvals
  • Loading branch information
AaronO committed Mar 26, 2021
commit 268cc7566f4ea88871a057192fbdff1e0f1b1c85
5 changes: 4 additions & 1 deletion core/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,13 @@ impl JsError {

// Read an array of structured frames from error.__callSiteEvals.
let frames_v8 = get_property(scope, exception, "__callSiteEvals");
// Ignore non-array values
let frames_v8: Option<v8::Local<v8::Array>> =
frames_v8.and_then(|a| a.try_into().ok());

// Convert them into Vec<JSStack>
let frames: Vec<JsStackFrame> = match frames_v8 {
Some(frames_v8) => serde_v8::from_v8(scope, frames_v8).unwrap(),
Some(frames_v8) => serde_v8::from_v8(scope, frames_v8.into()).unwrap(),
None => vec![],
};
(message, frames, e.stack)
Expand Down