1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-07-31 03:10:12 +02:00

Make sure the ScriptJob fails if script does not return an object for a request

This commit is contained in:
Dominik Schmidt
2014-12-05 05:02:50 +01:00
parent 558e6f5294
commit 507df5317e

View File

@@ -608,12 +608,22 @@ Tomahawk.PluginManager = {
invoke: function (requestId, objectId, methodName, params ) {
this.objects[objectId][methodName](params).then(function (result) {
if (typeof result === 'object') {
Tomahawk.reportScriptJobResults({
requestId: requestId,
data: result
});
} else {
Tomahawk.reportScriptJobResults({
requestId: requestId,
error: "Scripts need to return objects for requests"
});
}
}, function (error) {
Tomahawk.reportScriptJobResults({
requestId: requestId,
data: result
error: error
});
}, function (error) {
Tomahawk.reportScriptJobResults({error: error});
});
}
};