Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

`JSError.ThrowTypeError` / `ThrowRangeError` / `ThrowSyntaxError` throw a plain `Error`

オープン
#509 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

@r-Larch がすでに取り組んでいます。

2026年10月21日 から。

  • #511 @r-Larch による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
58/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
csharp, node.js
領域
backend

調査の方向性

Start with the string overloads in src/NodeApi/JSError.cs and compare them with the typed throw methods available on JSRuntime. Change each overload to call the matching runtime method. The issue mentions a PR test checking name, instanceof, message and code; use those checks to confirm all four error types behave as expected.

索引モデルが issue の本文から書いたものです。

説明

The string overloads of the typed throw helpers in src/NodeApi/JSError.cs all call JSRuntime.ThrowError:

public static void ThrowTypeError(string message)
    => JSValue.GetCurrentRuntime(out napi_env env).ThrowError(env, code: null, message);   // should be ThrowTypeError

The same applies to ThrowTypeError(code, message), ThrowRangeError(message), ThrowRangeError(code, message), ThrowSyntaxError(message) and ThrowSyntaxError(code, message). JS therefore receives an Error:

try { dotnetCallbackThatCallsThrowTypeError(); }
catch (e) {
  e instanceof TypeError; // false
  e.name;                 // 'Error'
}

JSRuntime already has ThrowTypeError, ThrowRangeError and ThrowSyntaxError (napi_throw_type_error, napi_throw_range_error, node_api_throw_syntax_error); they just are not called. Fix: call the matching runtime method. I have a PR with a test that checks name, instanceof, message and code for all four error types.

Version: main (54d2b74), 0.9.21 and 0.9.28.

主要言語
C#
スター
789
フォーク
81
平均マージ
34分
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/node-api-dotnet のほかの issue

microsoft/node-api-dotnet の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。