vm.Module.evaluate() morphs loader errors into module evaluation rejections
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 25/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 活発
- 技術スタック
- javascript
- 領域
- backend
調査の方向性
vm.Module.evaluate() から始め、リンク先の pull request の議論を読んで、検証エラーと loader エラーが現在どのように通知されているかに注目してください。同期 loader が loader エラーとモジュール評価エラーを区別できる方法についてプロジェクトが合意した時点で、issue は完了です。
索引モデルが issue の本文から書いたものです。
説明
This came up in https://github.com/nodejs/node/pull/60205#discussion_r2423587581 when I was trying to make vm.Module.evaluate() return the module evaluation promise as-is (so synchronously fulfilled for synthetic modules and source text modules without TLA). Currently the validation errors, ERR_VM_MODULE_STATUS, THROW_ERR_SCRIPT_EXECUTION_TIMEOUT, and THROW_ERR_SCRIPT_EXECUTION_INTERRUPTED would always be rejected, so for a synchronous loader, they would either have to expose these underlying rejections to users when the loading goes wrong, or be forced to become asynchronous as it cannot catch these errors synchronously and paint it over. i.e. they cannot do something like this:
function syncLoad() {
try {
mod.evaluate();
} catch(e) { // This allows the user to get the loader errors synchronously
if (e.code === 'ERR_VM_MODULE_STATUS' ||
e.code === 'ERR_SCRIPT_EXECUTION_INTERRUPTED' ||
e.code === 'ERR_SCRIPT_EXECUTION_TIMEOUT') {
// fix it up and try again, or error and explain to user what to do
// but hide the errors that do not directly come from module code
// as implementation detail
}
}
if (mod.status === 'errored') {
throw mod.error; // It's an evaluation error from the module code
}
return mod.namespace;
}
Opening a separate issue to discuss if there's another way to make this possible other than just making it throw these loader errors synchronously.
- 主要言語
- JavaScript
- スター
- 122k
- フォーク
- 37.4k
- 平均マージ
- 4日 3時間
- マージ済み PR(30日)
- 272
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nodejs/node のほかの issue
-
doc
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
build
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
-
feature request
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
似ている issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
babalae/bettergi-scripts-list#3674 ·
-
ecosystem wording
難易度 1/5 1時間未満 初心者へのやさしさ 90/100
matrix-org/matrix.org#3649 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
vadimdemedes/ink#1029 ·
-
code-quality refactoring
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
github/gh-aw-firewall#8816 ·
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
langchain-ai/deepagents#6450 ·