Pause on uncaught exceptions stops at wrong position with ES modules
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- JavaScript
- Estrellas
- 122k
- Forks
- 37.3k
- Merge medio
- 4 d 2 h
- PR fusionados (30 d)
- 283
Descripción
- 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
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Empieza reproduciendo el problema del repositorio vinculado node-38439 con la configuración de excepciones no capturadas del depurador, comparando no-bug/index.js con bug/index.js. Lee el manejo de la pausa alrededor de module_job.js y los puntos de entrada del inspector; se considera terminado cuando los módulos ES se pausan en la ubicación del throw en lugar de hacerlo dentro del código interno de módulos.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript, nodejs
- Área
- devtools
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Tranquilo
- Claridad
- Bastante claro
- Aptitud para principiantes
- 52/100