Open Bug 1451695 Opened 6 years ago Updated 2 years ago

Post-process promise rejections so that they get logged with the right stack information and proper summary

Categories

(Firefox :: General, defect, P3)

defect

Tracking

()

Tracking Status
firefox61 --- affected

People

(Reporter: Gijs, Unassigned)

References

Details

+++ This bug was initially created as a clone of Bug #1445009 +++
e.g. https://sentry.prod.mozaws.net/operations/nightly-js-errors/issues/3493506/

in sentry this looks like:

A promise chain failed to handle a rejection. Did you forget to '.catch', or did you forget to 'return'? See https

followed by a smaller-font description that then has:

//developer.mozilla.org/Mozilla/JavaScript_code_modules/Promise.jsm/Promise Date: Thu Apr 05 2018 09:38:01 GMT+0000 (UTC) Full Message: TypeError: this.colorSelect is null Full Stack: initializeColorWidget@resource://devtools/shared/base-loader.js -> resource://devtools/client/shared/widgets/ColorWidget.js:363:5 ColorWidget@resource://devtools/shared/base-loader.js -> resource://devtools/client/shared/widgets/ColorWidget.js:58:3 setColorPickerContent@resource://devtools/shared/base-loader.js -> resource://devtools/client/shared/widgets/tooltip/SwatchColorPickerTooltip.js:66:16 SwatchColorPickerTooltip@resource://devtools/shared/base-loader.js -> resource://devtools/client/shared/widgets/tooltip/SwatchColorPickerTooltip.js:43:21 getTooltip@resource://devtools/shared/base-loader.js -> resource://devtools/client/inspector/shared/tooltips-overlay.js:111:19 update@resource://devtools/shared/base-loader.js -> resource://devtools/client/inspector/rules/views/text-property-editor.js:436:9 TextPropertyEditor@resou..


this isn't particularly useful. The stack does get displayed in teletype text lower down, which makes it OK to read once you see the details - but it's impossible to distinguish different promise rejections in the lists, and it'd be much nicer if sentry processed the stack 'properly', leading to full source for the context in the UI, proper consolidation of identical issues, etc. etc.

I wonder if we can construct the script error instances for these promise rejections better, so they display in the console with the stack linked up and toggle-able etc. Paolo, do you know?

If not, we can try to work around this in the error reporter code, I guess.
Flags: needinfo?(paolo.mozmail)
This message can only appear in production code for Promise.jsm rejections, and we plan to remove the module in bug 1378173. This can be done after the last usages in DevTools are removed, which is slowly happening in the dependencies of bug 1384527.

The more interesting question is what happens to native Promises when they are left uncaught. I'd expect that currently we wouldn't show anything in the console, and it may be non-trivial to implement something that works in production code, for performance reasons.

Our testing frameworks may already detect some cases of uncaught rejections, but clearly not those on error paths that are not exercised. The situation can likely be improved using linting rules, so if someone has spare cycles it may be better to work on bug 1362972 or just add the missing "catch" or "return" in DevTools, more than fixing the error reporting of the obsolete module.
Flags: needinfo?(paolo.mozmail)
Priority: -- → P3
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.