mirror of
https://github.com/overte-org/overte.git
synced 2025-08-10 23:32:48 +02:00
error handling
This commit is contained in:
parent
3e7d303661
commit
76048f3c30
2 changed files with 7 additions and 4 deletions
|
@ -61,13 +61,15 @@ void AssetScriptingInterface::getMapping(QString path, QScriptValue callback) {
|
||||||
auto result = request->getError();
|
auto result = request->getError();
|
||||||
if (callback.isFunction()) {
|
if (callback.isFunction()) {
|
||||||
if (result == GetMappingRequest::NotFound) {
|
if (result == GetMappingRequest::NotFound) {
|
||||||
QScriptValueList args { "" };
|
QScriptValueList args { "", true };
|
||||||
callback.call(_engine->currentContext()->thisObject(), args);
|
callback.call(_engine->currentContext()->thisObject(), args);
|
||||||
} else if (result == GetMappingRequest::NoError) {
|
} else if (result == GetMappingRequest::NoError) {
|
||||||
QScriptValueList args { request->getHash() };
|
QScriptValueList args { request->getHash(), true };
|
||||||
callback.call(_engine->currentContext()->thisObject(), args);
|
callback.call(_engine->currentContext()->thisObject(), args);
|
||||||
} else {
|
} else {
|
||||||
qCDebug(scriptengine) << "error -- " << request->getError() << " -- " << request->getErrorString();
|
qCDebug(scriptengine) << "error -- " << request->getError() << " -- " << request->getErrorString();
|
||||||
|
QScriptValueList args { "", false };
|
||||||
|
callback.call(_engine->currentContext()->thisObject(), args);
|
||||||
}
|
}
|
||||||
request->deleteLater();
|
request->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,9 +85,10 @@ public:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* Called when getMapping is complete
|
* Called when getMapping is complete.
|
||||||
* @callback Assets~getMappingCallback
|
* @callback Assets~getMappingCallback
|
||||||
* @param {string} assetID
|
* @param assetID {string} hash value if found, else an empty string
|
||||||
|
* @param success {boolean} false for errors other than "not found", else true
|
||||||
*/
|
*/
|
||||||
Q_INVOKABLE void getMapping(QString path, QScriptValue callback);
|
Q_INVOKABLE void getMapping(QString path, QScriptValue callback);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue