mirror of
https://github.com/denoland/deno.git
synced 2024-12-31 03:29:10 -05:00
parent
18ac7d40c8
commit
bdb1ee6480
4 changed files with 16 additions and 4 deletions
6
cli/tests/082_prepare_stack_trace_throw.js
Normal file
6
cli/tests/082_prepare_stack_trace_throw.js
Normal file
|
@ -0,0 +1,6 @@
|
|||
Error.prepareStackTrace = () => {
|
||||
console.trace();
|
||||
throw new Error("foo");
|
||||
};
|
||||
|
||||
new Error("bar").stack;
|
2
cli/tests/082_prepare_stack_trace_throw.js.out
Normal file
2
cli/tests/082_prepare_stack_trace_throw.js.out
Normal file
|
@ -0,0 +1,2 @@
|
|||
[WILDCARD]error: Uncaught Error: foo
|
||||
[WILDCARD]
|
|
@ -2685,6 +2685,12 @@ itest!(_081_location_relative_fetch_redirect {
|
|||
http_server: true,
|
||||
});
|
||||
|
||||
itest!(_082_prepare_stack_trace_throw {
|
||||
args: "run 082_prepare_stack_trace_throw.js",
|
||||
output: "082_prepare_stack_trace_throw.js.out",
|
||||
exit_code: 1,
|
||||
});
|
||||
|
||||
itest!(js_import_detect {
|
||||
args: "run --quiet --reload js_import_detect.ts",
|
||||
output: "js_import_detect.ts.out",
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue