Closed Bug 1636691 Opened 11 months ago Closed 11 months 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)
Duplicate of this bug: 1083849
Blocks: 1634800
Status: NEW → RESOLVED
Closed: 11 months 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: 11 months ago11 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78
You need to log in before you can comment on or make changes to this bug.