Re-work error checking

This commit is contained in:
Shane Kilkelly 2017-06-22 09:41:36 +01:00
parent d0bbe8beae
commit ba9477cdb3

View file

@ -11,11 +11,12 @@ module.exports =
timeout: 30 * 1000
killSignal: "SIGKILL"
exec args, opts,(err, stdout, stderr)->
if err? and err?.signal == 'SIGKILL'
logger.warn {err: err, stderr: stderr, localPath: localPath}, "optimiser timeout reached"
err = null
if err?
logger.err err:err, stderr:stderr, localPath:localPath, "something went wrong converting compressPng"
if err.signal == 'SIGKILL'
logger.warn {err: err, stderr: stderr, localPath: localPath}, "optimiser timeout reached"
err = null
else
logger.err err:err, stderr:stderr, localPath:localPath, "something went wrong converting compressPng"
else
logger.log localPath:localPath, "finished compressPng file"
callback(err)