@@ -816,12 +816,7 @@ napi_status napi_define_class(napi_env env,
816816 }
817817
818818 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));
825820
826821 v8::PropertyAttribute attributes =
827822 v8impl::V8PropertyAttributesFromDescriptor (p);
@@ -888,12 +883,10 @@ napi_status napi_define_class(napi_env env,
888883 }
889884 }
890885
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 ()));
897890 }
898891
899892 return GET_RETURN_STATUS (env);
@@ -1268,12 +1261,7 @@ napi_status napi_define_properties(napi_env env,
12681261 const napi_property_descriptor* p = &properties[i];
12691262
12701263 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));
12771265
12781266 if (p->getter != nullptr || p->setter != nullptr ) {
12791267 v8::Local<v8::Value> local_getter;
@@ -1724,8 +1712,7 @@ napi_status napi_create_error(napi_env env,
17241712
17251713 v8::Local<v8::Value> error_obj =
17261714 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 ));
17291716
17301717 *result = v8impl::JsValueFromV8LocalValue (error_obj);
17311718
@@ -1745,8 +1732,7 @@ napi_status napi_create_type_error(napi_env env,
17451732
17461733 v8::Local<v8::Value> error_obj =
17471734 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 ));
17501736
17511737 *result = v8impl::JsValueFromV8LocalValue (error_obj);
17521738
@@ -1766,8 +1752,7 @@ napi_status napi_create_range_error(napi_env env,
17661752
17671753 v8::Local<v8::Value> error_obj =
17681754 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 ));
17711756
17721757 *result = v8impl::JsValueFromV8LocalValue (error_obj);
17731758
@@ -1947,8 +1932,7 @@ napi_status napi_throw_error(napi_env env,
19471932 CHECK_NEW_FROM_UTF8 (env, str, msg);
19481933
19491934 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));
19521936
19531937 isolate->ThrowException (error_obj);
19541938 // any VM calls after this point and before returning
@@ -1966,8 +1950,7 @@ napi_status napi_throw_type_error(napi_env env,
19661950 CHECK_NEW_FROM_UTF8 (env, str, msg);
19671951
19681952 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));
19711954
19721955 isolate->ThrowException (error_obj);
19731956 // any VM calls after this point and before returning
@@ -1985,8 +1968,7 @@ napi_status napi_throw_range_error(napi_env env,
19851968 CHECK_NEW_FROM_UTF8 (env, str, msg);
19861969
19871970 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));
19901972
19911973 isolate->ThrowException (error_obj);
19921974 // any VM calls after this point and before returning
@@ -2785,15 +2767,13 @@ napi_status napi_create_external_arraybuffer(napi_env env,
27852767 // and is able to use napi_env. Implementing that properly is hard, so use the
27862768 // `Buffer` variant for easier implementation.
27872769 napi_value buffer;
2788- napi_status status;
2789- status = napi_create_external_buffer (
2770+ STATUS_CALL (napi_create_external_buffer (
27902771 env,
27912772 byte_length,
27922773 external_data,
27932774 finalize_cb,
27942775 finalize_hint,
2795- &buffer);
2796- if (status != napi_ok) return status;
2776+ &buffer));
27972777 return napi_get_typedarray_info (
27982778 env,
27992779 buffer,
0 commit comments