Pause on uncaught exceptions stops at wrong position with ES modules
まだ誰も着手していません。
- 主要言語
- JavaScript
- スター
- 122k
- フォーク
- 37.3k
- 平均マージ
- 4日 2時間
- マージ済み PR(30日)
- 283
説明
- 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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、デバッガーの未捕捉例外設定を使って、リンク先の node-38439 リポジトリで問題を再現し、no-bug/index.js と bug/index.js を比較します。module_job.js 周辺の一時停止処理と inspector のエントリーポイントを読みます。完了条件は、ES モジュールが内部モジュールコード内ではなく throw の位置で一時停止することです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, nodejs
- 領域
- devtools
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 静か
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 52/100