Remove tmp file on image processing error
This commit is contained in:
parent
9c85ee2ed0
commit
4ee7a4c9ac
2 changed files with 9 additions and 2 deletions
|
@ -50,7 +50,14 @@ async function downloadImage (url: string, destDir: string, destName: string, si
|
|||
await doRequestAndSaveToFile({ method: 'GET', uri: url }, tmpPath)
|
||||
|
||||
const destPath = join(destDir, destName)
|
||||
|
||||
try {
|
||||
await processImage({ path: tmpPath }, destPath, size)
|
||||
} catch (err) {
|
||||
await remove(tmpPath)
|
||||
|
||||
throw err
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
|
|
@ -270,7 +270,7 @@ async function refreshActorIfNeeded (
|
|||
return { refreshed: true, actor }
|
||||
})
|
||||
} catch (err) {
|
||||
logger.warn('Cannot refresh actor.', { err })
|
||||
logger.warn('Cannot refresh actor %s.', actor.url, { err })
|
||||
return { actor, refreshed: false }
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue