@@ -1236,29 +1236,32 @@ inline Value Object::Get(const std::string& utf8name) const {
12361236}
12371237
12381238template <typename ValueType>
1239- inline void Object::Set (napi_value key, const ValueType& value) {
1239+ inline bool Object::Set (napi_value key, const ValueType& value) {
12401240 napi_status status =
12411241 napi_set_property (_env, _value, key, Value::From (_env, value));
1242- NAPI_THROW_IF_FAILED_VOID (_env, status);
1242+ NAPI_THROW_IF_FAILED (_env, status, false );
1243+ return true ;
12431244}
12441245
12451246template <typename ValueType>
1246- inline void Object::Set (Value key, const ValueType& value) {
1247+ inline bool Object::Set (Value key, const ValueType& value) {
12471248 napi_status status =
12481249 napi_set_property (_env, _value, key, Value::From (_env, value));
1249- NAPI_THROW_IF_FAILED_VOID (_env, status);
1250+ NAPI_THROW_IF_FAILED (_env, status, false );
1251+ return true ;
12501252}
12511253
12521254template <typename ValueType>
1253- inline void Object::Set (const char * utf8name, const ValueType& value) {
1255+ inline bool Object::Set (const char * utf8name, const ValueType& value) {
12541256 napi_status status =
12551257 napi_set_named_property (_env, _value, utf8name, Value::From (_env, value));
1256- NAPI_THROW_IF_FAILED_VOID (_env, status);
1258+ NAPI_THROW_IF_FAILED (_env, status, false );
1259+ return true ;
12571260}
12581261
12591262template <typename ValueType>
1260- inline void Object::Set (const std::string& utf8name, const ValueType& value) {
1261- Set (utf8name.c_str (), value);
1263+ inline bool Object::Set (const std::string& utf8name, const ValueType& value) {
1264+ return Set (utf8name.c_str (), value);
12621265}
12631266
12641267inline bool Object::Delete (napi_value key) {
@@ -1298,10 +1301,11 @@ inline Value Object::Get(uint32_t index) const {
12981301}
12991302
13001303template <typename ValueType>
1301- inline void Object::Set (uint32_t index, const ValueType& value) {
1304+ inline bool Object::Set (uint32_t index, const ValueType& value) {
13021305 napi_status status =
13031306 napi_set_element (_env, _value, index, Value::From (_env, value));
1304- NAPI_THROW_IF_FAILED_VOID (_env, status);
1307+ NAPI_THROW_IF_FAILED (_env, status, false );
1308+ return true ;
13051309}
13061310
13071311inline bool Object::Delete (uint32_t index) {
@@ -1318,22 +1322,27 @@ inline Array Object::GetPropertyNames() const {
13181322 return Array (_env, result);
13191323}
13201324
1321- inline void Object::DefineProperty (const PropertyDescriptor& property) {
1325+ inline bool Object::DefineProperty (const PropertyDescriptor& property) {
13221326 napi_status status = napi_define_properties (_env, _value, 1 ,
13231327 reinterpret_cast <const napi_property_descriptor*>(&property));
1324- NAPI_THROW_IF_FAILED_VOID (_env, status);
1328+ NAPI_THROW_IF_FAILED (_env, status, false );
1329+ return true ;
13251330}
13261331
1327- inline void Object::DefineProperties (const std::initializer_list<PropertyDescriptor>& properties) {
1332+ inline bool Object::DefineProperties (
1333+ const std::initializer_list<PropertyDescriptor>& properties) {
13281334 napi_status status = napi_define_properties (_env, _value, properties.size (),
13291335 reinterpret_cast <const napi_property_descriptor*>(properties.begin ()));
1330- NAPI_THROW_IF_FAILED_VOID (_env, status);
1336+ NAPI_THROW_IF_FAILED (_env, status, false );
1337+ return true ;
13311338}
13321339
1333- inline void Object::DefineProperties (const std::vector<PropertyDescriptor>& properties) {
1340+ inline bool Object::DefineProperties (
1341+ const std::vector<PropertyDescriptor>& properties) {
13341342 napi_status status = napi_define_properties (_env, _value, properties.size (),
13351343 reinterpret_cast <const napi_property_descriptor*>(properties.data ()));
1336- NAPI_THROW_IF_FAILED_VOID (_env, status);
1344+ NAPI_THROW_IF_FAILED (_env, status, false );
1345+ return true ;
13371346}
13381347
13391348inline bool Object::InstanceOf (const Function& constructor) const {
@@ -2678,89 +2687,93 @@ inline Napi::Value ObjectReference::Get(const std::string& utf8name) const {
26782687 return scope.Escape (Value ().Get (utf8name));
26792688}
26802689
2681- inline void ObjectReference::Set (const char * utf8name, napi_value value) {
2690+ inline bool ObjectReference::Set (const char * utf8name, napi_value value) {
26822691 HandleScope scope (_env);
2683- Value ().Set (utf8name, value);
2692+ return Value ().Set (utf8name, value);
26842693}
26852694
2686- inline void ObjectReference::Set (const char * utf8name, Napi::Value value) {
2695+ inline bool ObjectReference::Set (const char * utf8name, Napi::Value value) {
26872696 HandleScope scope (_env);
2688- Value ().Set (utf8name, value);
2697+ return Value ().Set (utf8name, value);
26892698}
26902699
2691- inline void ObjectReference::Set (const char * utf8name, const char * utf8value) {
2700+ inline bool ObjectReference::Set (const char * utf8name, const char * utf8value) {
26922701 HandleScope scope (_env);
2693- Value ().Set (utf8name, utf8value);
2702+ return Value ().Set (utf8name, utf8value);
26942703}
26952704
2696- inline void ObjectReference::Set (const char * utf8name, bool boolValue) {
2705+ inline bool ObjectReference::Set (const char * utf8name, bool boolValue) {
26972706 HandleScope scope (_env);
2698- Value ().Set (utf8name, boolValue);
2707+ return Value ().Set (utf8name, boolValue);
26992708}
27002709
2701- inline void ObjectReference::Set (const char * utf8name, double numberValue) {
2710+ inline bool ObjectReference::Set (const char * utf8name, double numberValue) {
27022711 HandleScope scope (_env);
2703- Value ().Set (utf8name, numberValue);
2712+ return Value ().Set (utf8name, numberValue);
27042713}
27052714
2706- inline void ObjectReference::Set (const std::string& utf8name, napi_value value) {
2715+ inline bool ObjectReference::Set (const std::string& utf8name,
2716+ napi_value value) {
27072717 HandleScope scope (_env);
2708- Value ().Set (utf8name, value);
2718+ return Value ().Set (utf8name, value);
27092719}
27102720
2711- inline void ObjectReference::Set (const std::string& utf8name, Napi::Value value) {
2721+ inline bool ObjectReference::Set (const std::string& utf8name,
2722+ Napi::Value value) {
27122723 HandleScope scope (_env);
2713- Value ().Set (utf8name, value);
2724+ return Value ().Set (utf8name, value);
27142725}
27152726
2716- inline void ObjectReference::Set (const std::string& utf8name, std::string& utf8value) {
2727+ inline bool ObjectReference::Set (const std::string& utf8name,
2728+ std::string& utf8value) {
27172729 HandleScope scope (_env);
2718- Value ().Set (utf8name, utf8value);
2730+ return Value ().Set (utf8name, utf8value);
27192731}
27202732
2721- inline void ObjectReference::Set (const std::string& utf8name, bool boolValue) {
2733+ inline bool ObjectReference::Set (const std::string& utf8name, bool boolValue) {
27222734 HandleScope scope (_env);
2723- Value ().Set (utf8name, boolValue);
2735+ return Value ().Set (utf8name, boolValue);
27242736}
27252737
2726- inline void ObjectReference::Set (const std::string& utf8name, double numberValue) {
2738+ inline bool ObjectReference::Set (const std::string& utf8name,
2739+ double numberValue) {
27272740 HandleScope scope (_env);
2728- Value ().Set (utf8name, numberValue);
2741+ return Value ().Set (utf8name, numberValue);
27292742}
27302743
27312744inline Napi::Value ObjectReference::Get (uint32_t index) const {
27322745 EscapableHandleScope scope (_env);
27332746 return scope.Escape (Value ().Get (index));
27342747}
27352748
2736- inline void ObjectReference::Set (uint32_t index, napi_value value) {
2749+ inline bool ObjectReference::Set (uint32_t index, napi_value value) {
27372750 HandleScope scope (_env);
2738- Value ().Set (index, value);
2751+ return Value ().Set (index, value);
27392752}
27402753
2741- inline void ObjectReference::Set (uint32_t index, Napi::Value value) {
2754+ inline bool ObjectReference::Set (uint32_t index, Napi::Value value) {
27422755 HandleScope scope (_env);
2743- Value ().Set (index, value);
2756+ return Value ().Set (index, value);
27442757}
27452758
2746- inline void ObjectReference::Set (uint32_t index, const char * utf8value) {
2759+ inline bool ObjectReference::Set (uint32_t index, const char * utf8value) {
27472760 HandleScope scope (_env);
2748- Value ().Set (index, utf8value);
2761+ return Value ().Set (index, utf8value);
27492762}
27502763
2751- inline void ObjectReference::Set (uint32_t index, const std::string& utf8value) {
2764+ inline bool ObjectReference::Set (uint32_t index, const std::string& utf8value) {
27522765 HandleScope scope (_env);
2753- Value ().Set (index, utf8value);
2766+ return Value ().Set (index, utf8value);
27542767}
27552768
2756- inline void ObjectReference::Set (uint32_t index, bool boolValue) {
2769+ inline bool ObjectReference::Set (uint32_t index, bool boolValue) {
27572770 HandleScope scope (_env);
2758- Value ().Set (index, boolValue);
2771+ return Value ().Set (index, boolValue);
27592772}
27602773
2761- inline void ObjectReference::Set (uint32_t index, double numberValue) {
2774+ inline bool ObjectReference::Set (uint32_t index, double numberValue) {
27622775 HandleScope scope (_env);
2763- Value ().Set (index, numberValue);
2776+ return Value ().Set (index, numberValue);
27642777}
27652778
27662779// //////////////////////////////////////////////////////////////////////////////
0 commit comments