Synchronous exceptions in ES modules are always 'caught'
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 122k
- Fork
- 37.3k
- Merge medio
- 4g 2h
- PR unite (30g)
- 283
Descrizione
Version
20.3.1
Platform
Darwin mbp.peet.io 22.6.0 Darwin Kernel Version 22.6.0: Fri Sep 15 13:39:52 PDT 2023; root:xnu-8796.141.3.700.8~1/RELEASE_X86_64 x86_64
Subsystem
inspector
What steps will reproduce the bug?
- Start a program containing
throw new Error('foo');in an ES module - Attach a debugger, like devtools or VS Code's debugger, and enable "pause on uncaught exceptions"
- Run the program
How often does it reproduce? Is there a required condition?
100%
What is the expected behavior? Why is that the expected behavior?
The runtime should pause on the throw line
What do you see instead?
The runtime does not pause and the program exits
Additional information
First reported in https://github.com/microsoft/vscode-js-debug/issues/1861
Guessing this is because module evaluation is in a try/catch. Wonder if there's any machinery that can be used to mark containing exceptions as uncaught
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia da lib/internal/modules/esm/module_job.js intorno alle righe 217-219 e riproduci il problema usando un modulo ES contenente un throw sincrono con un debugger collegato. Traccia il modo in cui l’inspector gestisce l’eccezione durante la valutazione del modulo; il lavoro è completato quando il debugger si interrompe sul throw con pause on uncaught exceptions abilitato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- devtools
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 42/100