update task status to error when tg_copy failed

This commit is contained in:
liaojack8 2020-07-07 01:32:46 +08:00
parent db3a1101a6
commit 769093719e
1 changed files with 5 additions and 0 deletions

View File

@ -249,6 +249,11 @@ async function tg_copy ({ fid, target, chat_id, update }) { // return task_id
sm({ chat_id, text, parse_mode: 'HTML' })
})
.catch(err => {
const task_id = record && record.id
if (task_id){
db.prepare('update task set status=? where id=?').run('error', task_id)
db.close()
}
if (!record) record = {}
console.error('複製失敗', fid, '-->', target)
console.error(err)