From 115de4c81ae6e009c66ac36748fa55f8d3b27b0f Mon Sep 17 00:00:00 2001 From: Deepanshu Utkarsh Date: Tue, 29 Dec 2020 09:24:19 -0500 Subject: [PATCH] fix(core): Fix incorrect index in Promise.all error reporting (#8913) --- cli/tests/error_024_stack_promise_all.ts | 1 + cli/tests/error_024_stack_promise_all.ts.out | 4 ++-- core/error.rs | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cli/tests/error_024_stack_promise_all.ts b/cli/tests/error_024_stack_promise_all.ts index 5334e8d77d..ddaf0dbaab 100644 --- a/cli/tests/error_024_stack_promise_all.ts +++ b/cli/tests/error_024_stack_promise_all.ts @@ -1,4 +1,5 @@ const p = Promise.all([ + Promise.resolve(), (async (): Promise => { await Promise.resolve(); throw new Error("Promise.all()"); diff --git a/cli/tests/error_024_stack_promise_all.ts.out b/cli/tests/error_024_stack_promise_all.ts.out index 38cb4ac313..e5528d6abc 100644 --- a/cli/tests/error_024_stack_promise_all.ts.out +++ b/cli/tests/error_024_stack_promise_all.ts.out @@ -1,8 +1,8 @@ [WILDCARD]Error: Promise.all() at [WILDCARD]tests/error_024_stack_promise_all.ts:[WILDCARD] - at async Promise.all (index 0) + at async Promise.all (index 1) at async [WILDCARD]tests/error_024_stack_promise_all.ts:[WILDCARD] error: Uncaught Error: Promise.all() at [WILDCARD]tests/error_024_stack_promise_all.ts:[WILDCARD] - at async Promise.all (index 0) + at async Promise.all (index 1) at async [WILDCARD]tests/error_024_stack_promise_all.ts:[WILDCARD] diff --git a/core/error.rs b/core/error.rs index 8e4138889a..fafa133b04 100644 --- a/core/error.rs +++ b/core/error.rs @@ -293,7 +293,7 @@ impl JsError { .unwrap(); let is_promise_all = is_promise_all.is_true(); let promise_index: Option> = - get_property(scope, call_site, "columnNumber") + get_property(scope, call_site, "promiseIndex") .unwrap() .try_into() .ok();