mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-16 22:30:42 +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();
|
||||
if (callback.isFunction()) {
|
||||
if (result == GetMappingRequest::NotFound) {
|
||||
QScriptValueList args { "" };
|
||||
QScriptValueList args { "", true };
|
||||
callback.call(_engine->currentContext()->thisObject(), args);
|
||||
} else if (result == GetMappingRequest::NoError) {
|
||||
QScriptValueList args { request->getHash() };
|
||||
QScriptValueList args { request->getHash(), true };
|
||||
callback.call(_engine->currentContext()->thisObject(), args);
|
||||
} else {
|
||||
qCDebug(scriptengine) << "error -- " << request->getError() << " -- " << request->getErrorString();
|
||||
QScriptValueList args { "", false };
|
||||
callback.call(_engine->currentContext()->thisObject(), args);
|
||||
}
|
||||
request->deleteLater();
|
||||
}
|
||||
|
|
|
@ -85,9 +85,10 @@ public:
|
|||
*/
|
||||
|
||||
/**jsdoc
|
||||
* Called when getMapping is complete
|
||||
* Called when getMapping is complete.
|
||||
* @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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue