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:
@@ -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});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
Reference in New Issue
Block a user