1
0
Fork 0

Remove tmp file on image processing error

This commit is contained in:
Chocobozzz 2019-04-15 15:04:02 +02:00
parent 9c85ee2ed0
commit 4ee7a4c9ac
No known key found for this signature in database
GPG key ID: 583A612D890159BE
2 changed files with 9 additions and 2 deletions

View file

@ -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
}
}
// ---------------------------------------------------------------------------

View file

@ -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 }
}
}