Showing the changes to libraries/script-engine/src/v8/ScriptObjectV8Proxy.cpp (1 of 9 files). Show all
Unified · Split
| @@ -657,6 +657,10 @@ void ScriptMethodV8Proxy::call(const v8::FunctionCallbackInfo<v8::Value>& argume · 656 unmodified lines | ||
| 657 | 657 | int bestMeta = 0; |
| 658 | 658 | int bestConversionPenaltyScore = 0; |
| 659 | 659 | |
| 660 | + if(fullName() == "SettingsScriptingInterface::getValue") { | |
| 661 | + printf("SettingsScriptingInterface::getValue"); | |
| 662 | + } | |
| 663 | + | |
| 660 | 664 | for (int i = 0; i < num_metas; i++) { |
| 661 | 665 | const QMetaMethod& meta = _metas[i]; |
| 662 | 666 | int methodNumArgs = meta.parameterCount(); |
| @@ -783,21 +787,25 @@ void ScriptMethodV8Proxy::call(const v8::FunctionCallbackInfo<v8::Value>& argume · 120 unmodified lines | ||
| 783 | 787 | int methodArgTypeId = meta.parameterType(arg); |
| 784 | 788 | Q_ASSERT(methodArgTypeId != QMetaType::UnknownType); |
| 785 | 789 | v8::Local<v8::Value> argVal = arguments[arg]; |
| 786 | − if (methodArgTypeId != scriptValueTypeId && methodArgTypeId != QMetaType::QVariant) { | |
| 790 | + if (methodArgTypeId != scriptValueTypeId) { | |
| 787 | 791 | QVariant varArgVal; |
| 788 | 792 | if (!_engine->castValueToVariant(V8ScriptValue(isolate, argVal), varArgVal, methodArgTypeId)) { |
| 789 | 793 | QByteArray methodTypeName = QMetaType(methodArgTypeId).name(); |
| 790 | 794 | QByteArray argTypeName = _engine->valueType(V8ScriptValue(isolate, argVal)).toLatin1(); |
| 791 | − isolate->ThrowError(v8::String::NewFromUtf8(isolate, QString("Native call of %1 failed: Cannot convert parameter %2 from %3 to %4") | |
| 792 | − .arg(fullName()).arg(arg+1).arg(argTypeName, methodTypeName).toStdString().c_str()).ToLocalChecked()); | |
| 795 | + QString errorMessage = QString("Native call of %1 failed: Cannot convert parameter %2 from %3 to %4") | |
| 796 | + .arg(fullName()).arg(arg+1).arg(argTypeName, methodTypeName); | |
| 797 | + qDebug(scriptengine) << errorMessage; | |
| 798 | + isolate->ThrowError(v8::String::NewFromUtf8(isolate, errorMessage.toStdString().c_str()).ToLocalChecked()); | |
| 793 | 799 | //context->throwError(V8ScriptContext::TypeError, QString("Native call of %1 failed: Cannot convert parameter %2 from %3 to %4") |
| 794 | 800 | // .arg(fullName()).arg(arg+1).arg(argTypeName, methodTypeName)); |
| 795 | 801 | return; |
| 796 | 802 | } |
| 797 | 803 | } |
| 798 | 804 | } |
| 799 | − | |
| 800 | − isolate->ThrowError(v8::String::NewFromUtf8(isolate, QString("Native call of %1 failed: could not locate an overload with the requested arguments").arg(fullName()).toStdString().c_str()).ToLocalChecked()); | |
| 805 | + QString errorMessage = QString("Native call of %1 failed: could not locate an overload with the requested arguments").arg(fullName()); | |
| 806 | + qDebug(scriptengine) << errorMessage; | |
| 807 | + isolate->ThrowError(v8::String::NewFromUtf8(isolate, errorMessage.toStdString().c_str()).ToLocalChecked()); | |
| 808 | + // V8TODO: it happens sometimes for some reason | |
| 801 | 809 | Q_ASSERT(false); // really shouldn't have gotten here -- it didn't work before and it's working now? |
| 802 | 810 | return; |
| 803 | 811 | } |