Closed Bug 1636691 Opened 4 years ago Closed 4 years ago

Improve stack information for promises due to exception in then/catch handlers

Categories

(Core :: JavaScript Engine, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla78
Tracking Status
firefox78 --- fixed

People

(Reporter: evilpie, Assigned: evilpie)

References

(Blocks 2 open bugs)

Details

Attachments

(1 file)

It seems like we just drop the exception stack when a promise resolve/reject callback throws. In particular MaybeGetAndClearException just ignores the exception stack. Instead we should probably propagate that stack through various Promise methods.

Compare

js> Promise.reject("foobar")
js> quit()
Unhandled rejection: "foobar"
Stack:
  @typein:1:9

and

js> Promise.resolve().then(() => { throw "foobar"; })
js> quit()
Unhandled rejection: "foobar"
(no stack trace available)
Blocks: 1634800
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Blocks: jserror

We already have the pending exception stack, we might as well use it.
This helps in cases where we reject the promises but the current stack is already empty again.

Assignee: nobody → evilpies
Type: task → enhancement
Depends on: 1636590
Severity: -- → N/A
Priority: -- → P3
Attachment #9147054 - Attachment description: Bug 1636691 - Use pending exception stack as rejection stack for Promises. r?arai → Bug 1636691 - Use pending exception stack as rejection stack for Promises. r?arai<Paste>
Pushed by evilpies@gmail.com: https://hg.mozilla.org/integration/autoland/rev/2b2753c09568 Use pending exception stack as rejection stack for Promises. r=arai<Paste>
Status: REOPENED → RESOLVED
Closed: 4 years ago4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: