Pause on uncaught exceptions stops at wrong position with ES modules
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- JavaScript
- Sterne
- 122k
- Forks
- 37.3k
- Ø Merge
- 4 T. 2 Std.
- Gemergte PRs (30 T.)
- 283
Beschreibung
- Version: 16.0.0
- Platform: Win 10 x64
- Subsystem: inspector
What steps will reproduce the bug?
Here's a repo with an easy reproduction:
- Open the repo in VS Code (or you can use another tool/any debugger)
- In the debug view (play button on the left hand side):
- Check the
[x] Uncaught Exceptionsbox in the breakpoints view. - Select "No Bug" and hit the play button. This runs
no-bug/index.js.
- Check the
- The debugger pauses at the location of the
throw - Now select "Repro Bug", and hit the play button. This runs
bug/index.js: the same code in an ES module. - The debugger pauses inside internal Node.js module code:

Under the hood this is just calling Debugger.setPauseOnExceptions({ state: 'uncaught' }), so it should be reproducable with any tool. In both cases this leads to a Debugger.pause, with the latter in the wrong location.
I'm guessing there's some inspector ✨magic that happens with commonjs that isn't happening for ES modules.
How often does it reproduce? Is there a required condition?
100%
What is the expected behavior?
In both cases, the debugger should pause on the throw
What do you see instead?
In ES modules, it pauses in module_job.js.
Additional information
This was originally reported in https://github.com/microsoft/vscode/issues/122246
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne damit, das Problem aus dem verknüpften Repository node-38439 mit der Einstellung für nicht abgefangene Ausnahmen des Debuggers zu reproduzieren, und vergleiche no-bug/index.js mit bug/index.js. Lies die Pausenbehandlung rund um module_job.js und die Einstiegspunkte des Inspectors; abgeschlossen ist die Aufgabe, wenn ES-Module an der Stelle des throw pausieren und nicht innerhalb des internen Modulcodes.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- javascript, nodejs
- Bereich
- devtools
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Ruhig
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 52/100