File tree 2 files changed +10
-4
lines changed
2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -1407,14 +1407,16 @@ napi_status napi_get_last_error_info(napi_env env,
1407
1407
CHECK_ENV (env);
1408
1408
CHECK_ARG (env, result);
1409
1409
1410
- // you must update this assert to reference the last message
1411
- // in the napi_status enum each time a new error message is added.
1410
+ // The value of the constant below must be updated to reference the last
1411
+ // message in the ` napi_status` enum each time a new error message is added.
1412
1412
// We don't have a napi_status_last as this would result in an ABI
1413
1413
// change each time a message was added.
1414
+ const int last_status = napi_date_expected;
1415
+
1414
1416
static_assert (
1415
- node::arraysize (error_messages) == napi_date_expected + 1 ,
1417
+ node::arraysize (error_messages) == last_status + 1 ,
1416
1418
" Count of error messages must match count of error values" );
1417
- CHECK_LE (env->last_error .error_code , napi_callback_scope_mismatch );
1419
+ CHECK_LE (env->last_error .error_code , last_status );
1418
1420
1419
1421
// Wait until someone requests the last error information to fetch the error
1420
1422
// message string
Original file line number Diff line number Diff line change @@ -84,6 +84,10 @@ typedef enum {
84
84
napi_bigint_expected ,
85
85
napi_date_expected ,
86
86
} napi_status ;
87
+ // Note: when adding a new enum value to `napi_status`, please also update
88
+ // `const int last_status` in `napi_get_last_error_info()' definition,
89
+ // in file js_native_api_v8.cc. Please also update the definition of
90
+ // `napi_status` in doc/api/n-api.md to reflect the newly added value(s).
87
91
88
92
#if NAPI_VERSION >= 4
89
93
typedef enum {
You can’t perform that action at this time.
0 commit comments