Synchronous exceptions in ES modules are always 'caught'
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 122k
- フォーク
- 37.3k
- 平均マージ
- 4日 2時間
- マージ済み PR(30日)
- 283
説明
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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
lib/internal/modules/esm/module_job.js の217〜219行付近から始め、デバッガーをアタッチした状態で同期的な throw を含む ES モジュールを使って問題を再現します。モジュール評価中に inspector が例外をどのように処理するかを追跡します。pause on uncaught exceptions が有効なときに、throw の箇所でデバッガーが一時停止すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 42/100