You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Start using JS string template in JS code (#19285)
It looks like these have been implements for a very long time in
all the engines: https://caniuse.com/template-literals
I just chose of libraries to start with, and will continue with others
if there are no objections.
throwBindingError("Function '"+humanName+"' called with an invalid number of arguments ("+arguments.length+") - expects one of ("+proto[methodName].overloadTable+")!");
96
+
throwBindingError(`Function '${humanName}' called with an invalid number of arguments (${arguments.length}) - expects one of (${proto[methodName].overloadTable})!`);
thrownewTypeError('Cannot convert "'+embindRepr(value)+'" to '+toTypeName);
549
+
thrownewTypeError(`Cannot convert "${embindRepr(value)}" to ${toTypeName}`);
550
550
}
551
551
if(value<minRange||value>maxRange){
552
-
thrownewTypeError('Passing a number "'+embindRepr(value)+'" from JS side to C/C++ side to an argument of type "'+name+'", which is outside the valid range ['+minRange+', '+maxRange+']!');
552
+
thrownewTypeError(`Passing a number "${embindRepr(value)}" from JS side to C/C++ side to an argument of type "${name}", which is outside the valid range [${minRange}, ${maxRange}]!`);
553
553
}
554
554
#endif
555
555
}
@@ -599,10 +599,10 @@ var LibraryEmbind = {
599
599
},
600
600
'toWireType': function(destructors,value){
601
601
if(typeofvalue!="bigint"&&typeofvalue!="number"){
602
-
thrownewTypeError('Cannot convert "'+embindRepr(value)+'" to '+this.name);
602
+
thrownewTypeError(`Cannot convert "${embindRepr(value)}" to ${this.name}`);
603
603
}
604
604
if(value<minRange||value>maxRange){
605
-
thrownewTypeError('Passing a number "'+embindRepr(value)+'" from JS side to C/C++ side to an argument of type "'+name+'", which is outside the valid range ['+minRange+', '+maxRange+']!');
605
+
thrownewTypeError(`Passing a number "${embindRepr(value)}" from JS side to C/C++ side to an argument of type "${name}", which is outside the valid range [${minRange}, ${maxRange}]!`);
throwBindingError('Cannot pass "'+embindRepr(handle)+'" as a '+this.name);
1435
+
throwBindingError(`Cannot pass "${embindRepr(handle)}" as a ${this.name}`);
1438
1436
}
1439
1437
if(!handle.$$.ptr){
1440
-
throwBindingError('Cannot pass deleted object as a pointer of type '+this.name);
1438
+
throwBindingError(`Cannot pass deleted object as a pointer of type ${this.name}`);
1441
1439
}
1442
1440
if(!this.isConst&&handle.$$.ptrType.isConst){
1443
-
throwBindingError('Cannot convert argument of type '+(handle.$$.smartPtrType ? handle.$$.smartPtrType.name : handle.$$.ptrType.name)+' to parameter type '+this.name);
1441
+
throwBindingError(`Cannot convert argument of type ${(handle.$$.smartPtrType ? handle.$$.smartPtrType.name : handle.$$.ptrType.name)}to parameter type ${this.name}`);
throwBindingError('Cannot convert argument of type '+(handle.$$.smartPtrType ? handle.$$.smartPtrType.name : handle.$$.ptrType.name)+' to parameter type '+this.name);
1460
+
throwBindingError(`Cannot convert argument of type ${(handle.$$.smartPtrType ? handle.$$.smartPtrType.name : handle.$$.ptrType.name)}to parameter type ${this.name}`);
1463
1461
}
1464
1462
break;
1465
1463
@@ -1503,7 +1501,7 @@ var LibraryEmbind = {
1503
1501
}
1504
1502
1505
1503
if(!handle.$$){
1506
-
throwBindingError('Cannot pass "'+embindRepr(handle)+'" as a '+this.name);
1504
+
throwBindingError(`Cannot pass "${embindRepr(handle)}" as a ${this.name}`);
1507
1505
}
1508
1506
if(!handle.$$.ptr){
1509
1507
throwBindingError('Cannot pass deleted object as a pointer of type '+this.name);
@@ -1525,13 +1523,13 @@ var LibraryEmbind = {
1525
1523
}
1526
1524
1527
1525
if(!handle.$$){
1528
-
throwBindingError('Cannot pass "'+embindRepr(handle)+'" as a '+this.name);
1526
+
throwBindingError(`Cannot pass "${embindRepr(handle)}" as a ${this.name}`);
1529
1527
}
1530
1528
if(!handle.$$.ptr){
1531
-
throwBindingError('Cannot pass deleted object as a pointer of type '+this.name);
1529
+
throwBindingError(`Cannot pass deleted object as a pointer of type ${this.name}`);
1532
1530
}
1533
1531
if(handle.$$.ptrType.isConst){
1534
-
throwBindingError('Cannot convert argument of type '+handle.$$.ptrType.name+' to parameter type '+this.name);
1532
+
throwBindingError(`Cannot convert argument of type ${handle.$$.ptrType.name}to parameter type ${this.name}`);
thrownewBindingError("Tried to invoke ctor of "+name+" with invalid number of parameters ("+arguments.length+") - expected ("+Object.keys(registeredClass.constructor_body).toString()+") parameters instead!");
2030
+
thrownewBindingError(`Tried to invoke ctor of ${name}with invalid number of parameters (${arguments.length}) - expected (${Object.keys(registeredClass.constructor_body).toString()}) parameters instead!`);
thrownewBindingError("Cannot register multiple constructors with identical number of parameters ("+(argCount-1)+") for class '"+classType.name+"'! Overload resolution is currently only performed using the parameter count, not actual type info!");
2106
+
thrownewBindingError(`Cannot register multiple constructors with identical number of parameters (${argCount-1}) for class '${classType.name}'! Overload resolution is currently only performed using the parameter count, not actual type info!`);
0 commit comments