From 3e466925d697469a2f0d434408ceab16ef934342 Mon Sep 17 00:00:00 2001 From: dbroqua Date: Tue, 12 Mar 2019 22:41:45 +0100 Subject: [PATCH] Added catch on fail resize --- libs/resize.js | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/libs/resize.js b/libs/resize.js index 24ba3bf..0f70d9e 100644 --- a/libs/resize.js +++ b/libs/resize.js @@ -24,15 +24,17 @@ class Resize { return false } - resizeImg(data, this.size).then(buf => { - fs.writeFile(output, buf, (err) => { - if (err) { - callback(err, null) - return false - } - callback(null, { input: input, output: output, size: this.size }) + resizeImg(data, this.size) + .then(buf => { + fs.writeFile(output, buf, (err) => { + if (err) { + callback(err, null) + return false + } + callback(null, { input: input, output: output, size: this.size }) + }) }) - }) + .catch(callback) }) }