From c952e3e8ce988ad29e5da26a9e80c3ea5d0aceb1 Mon Sep 17 00:00:00 2001 From: Bobby Wibowo Date: Wed, 9 May 2018 17:18:16 +0700 Subject: [PATCH] Updated utilsController.js Possibly better Cloudflare error handling. --- controllers/utilsController.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/controllers/utilsController.js b/controllers/utilsController.js index a1cc7a0..a7833e6 100644 --- a/controllers/utilsController.js +++ b/controllers/utilsController.js @@ -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}`)) } }