From c040c0a069d6571134c9f2c949b499a17fdb6801 Mon Sep 17 00:00:00 2001
From: Gkiokan Sali
Date: Sun, 30 Jan 2022 12:25:08 +0100
Subject: [PATCH] stop interval when error happens
---
src/renderer/pages/Changelog.vue | 1 +
src/renderer/pages/Index.vue | 41 +++++++++++++++++++++++++-------
2 files changed, 34 insertions(+), 8 deletions(-)
diff --git a/src/renderer/pages/Changelog.vue b/src/renderer/pages/Changelog.vue
index c0413cf..da46340 100644
--- a/src/renderer/pages/Changelog.vue
+++ b/src/renderer/pages/Changelog.vue
@@ -18,6 +18,7 @@
Added css to fix the header, so it stays there when you scroll.
Added prefix full path URL to the serving file (CyB1K request), so every file is unique.
Added Suport Information on Settings View if anyone want to help and support me.
+ Stop Interval if there is an error.
diff --git a/src/renderer/pages/Index.vue b/src/renderer/pages/Index.vue
index 57ba0b6..fd455d8 100644
--- a/src/renderer/pages/Index.vue
+++ b/src/renderer/pages/Index.vue
@@ -206,7 +206,10 @@ export default {
this.log(data.message, { exists, size, type })
this.$message({ message: data.message, type: data.type })
})
- .catch( e => console.log(e) )
+ .catch( e => {
+ this.clearInterval(file)
+ console.log(e)
+ })
},
start(file){
@@ -247,7 +250,10 @@ export default {
}
})
- .catch( e => console.log(e) )
+ .catch( e => {
+ this.clearInterval(file)
+ console.log(e)
+ })
},
stop(file){
@@ -261,7 +267,10 @@ export default {
this.setStatus(file, 'stop')
this.log(file.name + ' stop Task ID ' + file.task, data)
})
- .catch( e => console.log(e) )
+ .catch( e => {
+ this.clearInterval(file)
+ console.log(e)
+ })
},
pause(file){
@@ -275,7 +284,10 @@ export default {
this.setStatus(file, 'pause')
this.log(file.name + ' pause', data)
})
- .catch( e => console.log(e) )
+ .catch( e => {
+ this.clearInterval(file)
+ console.log(e)
+ })
},
resume(file){
@@ -293,7 +305,10 @@ export default {
this.log(file.name + ' resume Task ID ' + file.task, data)
}
})
- .catch( e => console.log(e) )
+ .catch( e => {
+ this.clearInterval(file)
+ console.log(e)
+ })
},
remove(file){
@@ -306,7 +321,10 @@ export default {
console.log(data)
this.log(file.name + ' remove', data)
})
- .catch( e => console.log(e) )
+ .catch( e => {
+ this.clearInterval(file)
+ console.log(e)
+ })
},
info(file){
@@ -370,10 +388,14 @@ export default {
else {
console.log("Task Info Fail", data)
this.log(file.name + ' Info fail', data)
+ this.clearInterval(file)
}
})
- .catch( e => console.log(e) )
+ .catch( e => {
+ this.clearInterval(file)
+ console.log(e)
+ })
// this.log(file.name + ' info')
},
@@ -383,7 +405,10 @@ export default {
.then( ({ data }) => {
this.log(file.name + ' find', data)
})
- .catch( e => console.log(e) )
+ .catch( e => {
+ this.clearInterval(file)
+ console.log(e)
+ })
},
startInterval(file){