Updated utilsController.js

Possibly better Cloudflare error handling.
This commit is contained in:
Bobby Wibowo 2018-05-09 17:18:16 +07:00
parent fbd38a8bdd
commit c952e3e8ce
No known key found for this signature in database
GPG Key ID: 51C3A1E1E22D26CF

View File

@ -217,7 +217,9 @@ utilsController.purgeCloudflareCache = async names => {
.send({ files: names.concat(thumbs) })
.catch(error => error)
if (purge.body && !purge.body.success) {
if (!purge.body) {
console.error(`CF: ${purge.toString()}`)
} else if (!purge.body.success && purge.body.errors) {
purge.body.errors.forEach(error => console.error(`CF: ${error.code}: ${error.message}`))
}
}