Handle task progress and termination (in plugin forms)

This commit is contained in:
jtc42 2019-11-01 17:48:01 +00:00
parent e2efa92232
commit 70533438d2
3 changed files with 209 additions and 7 deletions

View file

@ -162,8 +162,19 @@ export default new Vuex.Store({
}
// If task ends with an error
else if (result == 'error') {
// Pass the error string back with reject
reject(new Error(response.data.return))
}
// If task ends with termination
else if (result == 'terminated') {
// Pass a generic termination error back with reject
reject(new Error("Task terminated"))
}
// If task ends in any other way
else if (result != 'running') {
// Pass status string as error
reject(new Error(result))
}
// If the condition isn't met but the timeout hasn't elapsed, go again
else if (Number(new Date()) < endTime) {
setTimeout(checkCondition, interval, resolve, reject)