Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

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

Offen
#509 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

@r-Larch arbeitet bereits daran.

Seit 21.10.2026.

  • #511 von @r-Larch — offen

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
58/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
csharp, node.js
Bereich
backend

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
C#
Sterne
789
Forks
81
Ø Merge
4 T. 22 Std.
Gemergte PRs (30 T.)
4

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus microsoft/node-api-dotnet

Alle Issues in microsoft/node-api-dotnet

Ähnliche Issues

Weitere Issues zu C#

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.