添加下载失败信息状态

This commit is contained in:
lyswhut
2023-02-10 08:58:24 +08:00
parent ef9427122e
commit 6048af99bc
6 changed files with 78 additions and 62 deletions
+15 -5
View File
@@ -165,10 +165,20 @@ const createTask = async(downloadInfo: LX.Download.ListItem, savePath: string, s
let retryNum = tryNum.get(downloadInfo.id) ?? 0
tryNum.set(downloadInfo.id, ++retryNum)
if (retryNum > 2) {
sendAction(downloadInfo.id, {
action: 'error',
data: {},
})
if (response.statusCode) {
sendAction(downloadInfo.id, {
action: 'error',
data: {
error: 'download_status_error_response',
message: String(response.statusCode),
},
})
} else {
sendAction(downloadInfo.id, {
action: 'error',
data: {},
})
}
return
}
switch (response.statusCode) {
@@ -187,7 +197,7 @@ const createTask = async(downloadInfo: LX.Download.ListItem, savePath: string, s
}
},
onStart() {
// sendAction(downloadInfo.id, { action: 'start' })
sendAction(downloadInfo.id, { action: 'start' })
console.log('on start')
},
onProgress(status) {