@@ -1236,29 +1236,32 @@ inline Value Object::Get(const std::string& utf8name) const {
1236
1236
}
1237
1237
1238
1238
template <typename ValueType>
1239
- inline void Object::Set (napi_value key, const ValueType& value) {
1239
+ inline bool Object::Set (napi_value key, const ValueType& value) {
1240
1240
napi_status status =
1241
1241
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 ;
1243
1244
}
1244
1245
1245
1246
template <typename ValueType>
1246
- inline void Object::Set (Value key, const ValueType& value) {
1247
+ inline bool Object::Set (Value key, const ValueType& value) {
1247
1248
napi_status status =
1248
1249
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 ;
1250
1252
}
1251
1253
1252
1254
template <typename ValueType>
1253
- inline void Object::Set (const char * utf8name, const ValueType& value) {
1255
+ inline bool Object::Set (const char * utf8name, const ValueType& value) {
1254
1256
napi_status status =
1255
1257
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 ;
1257
1260
}
1258
1261
1259
1262
template <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);
1262
1265
}
1263
1266
1264
1267
inline bool Object::Delete (napi_value key) {
@@ -1298,10 +1301,11 @@ inline Value Object::Get(uint32_t index) const {
1298
1301
}
1299
1302
1300
1303
template <typename ValueType>
1301
- inline void Object::Set (uint32_t index, const ValueType& value) {
1304
+ inline bool Object::Set (uint32_t index, const ValueType& value) {
1302
1305
napi_status status =
1303
1306
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 ;
1305
1309
}
1306
1310
1307
1311
inline bool Object::Delete (uint32_t index) {
@@ -1318,22 +1322,27 @@ inline Array Object::GetPropertyNames() const {
1318
1322
return Array (_env, result);
1319
1323
}
1320
1324
1321
- inline void Object::DefineProperty (const PropertyDescriptor& property) {
1325
+ inline bool Object::DefineProperty (const PropertyDescriptor& property) {
1322
1326
napi_status status = napi_define_properties (_env, _value, 1 ,
1323
1327
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 ;
1325
1330
}
1326
1331
1327
- inline void Object::DefineProperties (const std::initializer_list<PropertyDescriptor>& properties) {
1332
+ inline bool Object::DefineProperties (
1333
+ const std::initializer_list<PropertyDescriptor>& properties) {
1328
1334
napi_status status = napi_define_properties (_env, _value, properties.size (),
1329
1335
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 ;
1331
1338
}
1332
1339
1333
- inline void Object::DefineProperties (const std::vector<PropertyDescriptor>& properties) {
1340
+ inline bool Object::DefineProperties (
1341
+ const std::vector<PropertyDescriptor>& properties) {
1334
1342
napi_status status = napi_define_properties (_env, _value, properties.size (),
1335
1343
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 ;
1337
1346
}
1338
1347
1339
1348
inline bool Object::InstanceOf (const Function& constructor) const {
@@ -2678,89 +2687,93 @@ inline Napi::Value ObjectReference::Get(const std::string& utf8name) const {
2678
2687
return scope.Escape (Value ().Get (utf8name));
2679
2688
}
2680
2689
2681
- inline void ObjectReference::Set (const char * utf8name, napi_value value) {
2690
+ inline bool ObjectReference::Set (const char * utf8name, napi_value value) {
2682
2691
HandleScope scope (_env);
2683
- Value ().Set (utf8name, value);
2692
+ return Value ().Set (utf8name, value);
2684
2693
}
2685
2694
2686
- inline void ObjectReference::Set (const char * utf8name, Napi::Value value) {
2695
+ inline bool ObjectReference::Set (const char * utf8name, Napi::Value value) {
2687
2696
HandleScope scope (_env);
2688
- Value ().Set (utf8name, value);
2697
+ return Value ().Set (utf8name, value);
2689
2698
}
2690
2699
2691
- inline void ObjectReference::Set (const char * utf8name, const char * utf8value) {
2700
+ inline bool ObjectReference::Set (const char * utf8name, const char * utf8value) {
2692
2701
HandleScope scope (_env);
2693
- Value ().Set (utf8name, utf8value);
2702
+ return Value ().Set (utf8name, utf8value);
2694
2703
}
2695
2704
2696
- inline void ObjectReference::Set (const char * utf8name, bool boolValue) {
2705
+ inline bool ObjectReference::Set (const char * utf8name, bool boolValue) {
2697
2706
HandleScope scope (_env);
2698
- Value ().Set (utf8name, boolValue);
2707
+ return Value ().Set (utf8name, boolValue);
2699
2708
}
2700
2709
2701
- inline void ObjectReference::Set (const char * utf8name, double numberValue) {
2710
+ inline bool ObjectReference::Set (const char * utf8name, double numberValue) {
2702
2711
HandleScope scope (_env);
2703
- Value ().Set (utf8name, numberValue);
2712
+ return Value ().Set (utf8name, numberValue);
2704
2713
}
2705
2714
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) {
2707
2717
HandleScope scope (_env);
2708
- Value ().Set (utf8name, value);
2718
+ return Value ().Set (utf8name, value);
2709
2719
}
2710
2720
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) {
2712
2723
HandleScope scope (_env);
2713
- Value ().Set (utf8name, value);
2724
+ return Value ().Set (utf8name, value);
2714
2725
}
2715
2726
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) {
2717
2729
HandleScope scope (_env);
2718
- Value ().Set (utf8name, utf8value);
2730
+ return Value ().Set (utf8name, utf8value);
2719
2731
}
2720
2732
2721
- inline void ObjectReference::Set (const std::string& utf8name, bool boolValue) {
2733
+ inline bool ObjectReference::Set (const std::string& utf8name, bool boolValue) {
2722
2734
HandleScope scope (_env);
2723
- Value ().Set (utf8name, boolValue);
2735
+ return Value ().Set (utf8name, boolValue);
2724
2736
}
2725
2737
2726
- inline void ObjectReference::Set (const std::string& utf8name, double numberValue) {
2738
+ inline bool ObjectReference::Set (const std::string& utf8name,
2739
+ double numberValue) {
2727
2740
HandleScope scope (_env);
2728
- Value ().Set (utf8name, numberValue);
2741
+ return Value ().Set (utf8name, numberValue);
2729
2742
}
2730
2743
2731
2744
inline Napi::Value ObjectReference::Get (uint32_t index) const {
2732
2745
EscapableHandleScope scope (_env);
2733
2746
return scope.Escape (Value ().Get (index));
2734
2747
}
2735
2748
2736
- inline void ObjectReference::Set (uint32_t index, napi_value value) {
2749
+ inline bool ObjectReference::Set (uint32_t index, napi_value value) {
2737
2750
HandleScope scope (_env);
2738
- Value ().Set (index, value);
2751
+ return Value ().Set (index, value);
2739
2752
}
2740
2753
2741
- inline void ObjectReference::Set (uint32_t index, Napi::Value value) {
2754
+ inline bool ObjectReference::Set (uint32_t index, Napi::Value value) {
2742
2755
HandleScope scope (_env);
2743
- Value ().Set (index, value);
2756
+ return Value ().Set (index, value);
2744
2757
}
2745
2758
2746
- inline void ObjectReference::Set (uint32_t index, const char * utf8value) {
2759
+ inline bool ObjectReference::Set (uint32_t index, const char * utf8value) {
2747
2760
HandleScope scope (_env);
2748
- Value ().Set (index, utf8value);
2761
+ return Value ().Set (index, utf8value);
2749
2762
}
2750
2763
2751
- inline void ObjectReference::Set (uint32_t index, const std::string& utf8value) {
2764
+ inline bool ObjectReference::Set (uint32_t index, const std::string& utf8value) {
2752
2765
HandleScope scope (_env);
2753
- Value ().Set (index, utf8value);
2766
+ return Value ().Set (index, utf8value);
2754
2767
}
2755
2768
2756
- inline void ObjectReference::Set (uint32_t index, bool boolValue) {
2769
+ inline bool ObjectReference::Set (uint32_t index, bool boolValue) {
2757
2770
HandleScope scope (_env);
2758
- Value ().Set (index, boolValue);
2771
+ return Value ().Set (index, boolValue);
2759
2772
}
2760
2773
2761
- inline void ObjectReference::Set (uint32_t index, double numberValue) {
2774
+ inline bool ObjectReference::Set (uint32_t index, double numberValue) {
2762
2775
HandleScope scope (_env);
2763
- Value ().Set (index, numberValue);
2776
+ return Value ().Set (index, numberValue);
2764
2777
}
2765
2778
2766
2779
// //////////////////////////////////////////////////////////////////////////////
0 commit comments