Report error status in setMapping() callback

This commit is contained in:
David Rowe 2017-04-07 10:31:52 +12:00
parent 23c937e55d
commit 0400e5a1f2
2 changed files with 3 additions and 1 deletions

View file

@ -44,7 +44,8 @@ void AssetScriptingInterface::setMapping(QString path, QString hash, QScriptValu
QObject::connect(setMappingRequest, &SetMappingRequest::finished, this, [this, callback](SetMappingRequest* request) mutable {
if (callback.isFunction()) {
QScriptValueList args { };
QString error = request->getErrorString();
QScriptValueList args { error };
callback.call(_engine->currentContext()->thisObject(), args);
}
request->deleteLater();

View file

@ -72,6 +72,7 @@ public:
/**jsdoc
* Called when setMapping is complete
* @callback Assets~setMappingCallback
* @param {string} error
*/
Q_INVOKABLE void setMapping(QString path, QString hash, QScriptValue callback);