mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-08-06 14:16:32 +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 ) {
|
invoke: function (requestId, objectId, methodName, params ) {
|
||||||
this.objects[objectId][methodName](params).then(function (result) {
|
this.objects[objectId][methodName](params).then(function (result) {
|
||||||
|
if (typeof result === 'object') {
|
||||||
Tomahawk.reportScriptJobResults({
|
Tomahawk.reportScriptJobResults({
|
||||||
requestId: requestId,
|
requestId: requestId,
|
||||||
data: result
|
data: result
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
Tomahawk.reportScriptJobResults({
|
||||||
|
requestId: requestId,
|
||||||
|
error: "Scripts need to return objects for requests"
|
||||||
|
});
|
||||||
|
}
|
||||||
}, function (error) {
|
}, function (error) {
|
||||||
Tomahawk.reportScriptJobResults({error: error});
|
Tomahawk.reportScriptJobResults({
|
||||||
|
requestId: requestId,
|
||||||
|
error: error
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user