Added catch on fail resize

This commit is contained in:
dbroqua 2019-03-12 22:41:45 +01:00
parent 2c03395371
commit 3e466925d6

View File

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