`JSError.ThrowTypeError` / `ThrowRangeError` / `ThrowSyntaxError` throw a plain `Error`
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 58/100
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- C#
- Star
- 789
- Fork
- 81
- Merge trung bình
- 4 ngày 22 giờ
- Pull request đã merge (30 ngày)
- 4
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/node-api-dotnet
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
microsoft/node-api-dotnet#484 · 1 bình luận ·
-
`PooledBuffer.FromStringUtf8`/`FromSpanUtf8` never write the NUL terminator → garbage in JS error messages and linked module names on .NETCó thể đã có người làm @r-Larch đã nhận 7 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 30/100
microsoft/node-api-dotnet#508 ·
-
JSError.ThrowError(Exception) aborts the process when a Worker terminates during a .NET callCó thể đã có người làm @GalaxiasKyklos đã nhận 15 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 18/100
microsoft/node-api-dotnet#505 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 70/100
microsoft/node-api-dotnet#504 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 82/100
microsoft/node-api-dotnet#502 ·
Tất cả issue của microsoft/node-api-dotnet
Issue tương tự
-
[Bug] Dashboard renders attachment links that resolve to 404 when the FILES binding is absentĐang mởbug 優先: 低
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 92/100
-
.NET area: storage bug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Larson-Logan/medal-sync#61 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area-ai bug untriaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
dotnet/extensions#7893 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 72/100