@@ -816,12 +816,7 @@ napi_status napi_define_class(napi_env env,
816
816
}
817
817
818
818
v8::Local<v8::Name> property_name;
819
- napi_status status =
820
- v8impl::V8NameFromPropertyDescriptor (env, p, &property_name);
821
-
822
- if (status != napi_ok) {
823
- return napi_set_last_error (env, status);
824
- }
819
+ STATUS_CALL (v8impl::V8NameFromPropertyDescriptor (env, p, &property_name));
825
820
826
821
v8::PropertyAttribute attributes =
827
822
v8impl::V8PropertyAttributesFromDescriptor (p);
@@ -888,12 +883,10 @@ napi_status napi_define_class(napi_env env,
888
883
}
889
884
}
890
885
891
- napi_status status =
892
- napi_define_properties (env,
893
- *result,
894
- static_descriptors.size (),
895
- static_descriptors.data ());
896
- if (status != napi_ok) return status;
886
+ STATUS_CALL (napi_define_properties (env,
887
+ *result,
888
+ static_descriptors.size (),
889
+ static_descriptors.data ()));
897
890
}
898
891
899
892
return GET_RETURN_STATUS (env);
@@ -1268,12 +1261,7 @@ napi_status napi_define_properties(napi_env env,
1268
1261
const napi_property_descriptor* p = &properties[i];
1269
1262
1270
1263
v8::Local<v8::Name> property_name;
1271
- napi_status status =
1272
- v8impl::V8NameFromPropertyDescriptor (env, p, &property_name);
1273
-
1274
- if (status != napi_ok) {
1275
- return napi_set_last_error (env, status);
1276
- }
1264
+ STATUS_CALL (v8impl::V8NameFromPropertyDescriptor (env, p, &property_name));
1277
1265
1278
1266
if (p->getter != nullptr || p->setter != nullptr ) {
1279
1267
v8::Local<v8::Value> local_getter;
@@ -1724,8 +1712,7 @@ napi_status napi_create_error(napi_env env,
1724
1712
1725
1713
v8::Local<v8::Value> error_obj =
1726
1714
v8::Exception::Error (message_value.As <v8::String>());
1727
- napi_status status = set_error_code (env, error_obj, code, nullptr );
1728
- if (status != napi_ok) return status;
1715
+ STATUS_CALL (set_error_code (env, error_obj, code, nullptr ));
1729
1716
1730
1717
*result = v8impl::JsValueFromV8LocalValue (error_obj);
1731
1718
@@ -1745,8 +1732,7 @@ napi_status napi_create_type_error(napi_env env,
1745
1732
1746
1733
v8::Local<v8::Value> error_obj =
1747
1734
v8::Exception::TypeError (message_value.As <v8::String>());
1748
- napi_status status = set_error_code (env, error_obj, code, nullptr );
1749
- if (status != napi_ok) return status;
1735
+ STATUS_CALL (set_error_code (env, error_obj, code, nullptr ));
1750
1736
1751
1737
*result = v8impl::JsValueFromV8LocalValue (error_obj);
1752
1738
@@ -1766,8 +1752,7 @@ napi_status napi_create_range_error(napi_env env,
1766
1752
1767
1753
v8::Local<v8::Value> error_obj =
1768
1754
v8::Exception::RangeError (message_value.As <v8::String>());
1769
- napi_status status = set_error_code (env, error_obj, code, nullptr );
1770
- if (status != napi_ok) return status;
1755
+ STATUS_CALL (set_error_code (env, error_obj, code, nullptr ));
1771
1756
1772
1757
*result = v8impl::JsValueFromV8LocalValue (error_obj);
1773
1758
@@ -1947,8 +1932,7 @@ napi_status napi_throw_error(napi_env env,
1947
1932
CHECK_NEW_FROM_UTF8 (env, str, msg);
1948
1933
1949
1934
v8::Local<v8::Value> error_obj = v8::Exception::Error (str);
1950
- napi_status status = set_error_code (env, error_obj, nullptr , code);
1951
- if (status != napi_ok) return status;
1935
+ STATUS_CALL (set_error_code (env, error_obj, nullptr , code));
1952
1936
1953
1937
isolate->ThrowException (error_obj);
1954
1938
// any VM calls after this point and before returning
@@ -1966,8 +1950,7 @@ napi_status napi_throw_type_error(napi_env env,
1966
1950
CHECK_NEW_FROM_UTF8 (env, str, msg);
1967
1951
1968
1952
v8::Local<v8::Value> error_obj = v8::Exception::TypeError (str);
1969
- napi_status status = set_error_code (env, error_obj, nullptr , code);
1970
- if (status != napi_ok) return status;
1953
+ STATUS_CALL (set_error_code (env, error_obj, nullptr , code));
1971
1954
1972
1955
isolate->ThrowException (error_obj);
1973
1956
// any VM calls after this point and before returning
@@ -1985,8 +1968,7 @@ napi_status napi_throw_range_error(napi_env env,
1985
1968
CHECK_NEW_FROM_UTF8 (env, str, msg);
1986
1969
1987
1970
v8::Local<v8::Value> error_obj = v8::Exception::RangeError (str);
1988
- napi_status status = set_error_code (env, error_obj, nullptr , code);
1989
- if (status != napi_ok) return status;
1971
+ STATUS_CALL (set_error_code (env, error_obj, nullptr , code));
1990
1972
1991
1973
isolate->ThrowException (error_obj);
1992
1974
// any VM calls after this point and before returning
@@ -2785,15 +2767,13 @@ napi_status napi_create_external_arraybuffer(napi_env env,
2785
2767
// and is able to use napi_env. Implementing that properly is hard, so use the
2786
2768
// `Buffer` variant for easier implementation.
2787
2769
napi_value buffer;
2788
- napi_status status;
2789
- status = napi_create_external_buffer (
2770
+ STATUS_CALL (napi_create_external_buffer (
2790
2771
env,
2791
2772
byte_length,
2792
2773
external_data,
2793
2774
finalize_cb,
2794
2775
finalize_hint,
2795
- &buffer);
2796
- if (status != napi_ok) return status;
2776
+ &buffer));
2797
2777
return napi_get_typedarray_info (
2798
2778
env,
2799
2779
buffer,
0 commit comments