diff --git a/print-server.js b/print-server.js index 9c1fbcb..c64d845 100644 --- a/print-server.js +++ b/print-server.js @@ -24,6 +24,8 @@ class PrintServer { const decoration = '△▽'.repeat(10); const printnatura = colors.bgBlack.bold(' Print'.white + 'Natura '.green); console.log(`${decoration} ${printnatura} ${decoration}`); + if (this.conf.debug) + this.serverLog('log', 'Debug mode enabled'.yellow); if (this.conf.dryPrint) this.serverLog('log', 'Running in dry print mode, documents won\'t be printed'.yellow); if (this.conf.keepFile) @@ -248,7 +250,7 @@ class PrintServer { const resErr = new Error(`${err.message}: ${resMessage}`); resErr.stack = err.stack; throw resErr; - } + } } else throw err; } @@ -270,7 +272,7 @@ class PrintServer { if (!conf.dryPrint) await pExec(printCommand); } catch(err) { throw new Error(`Print error: ${err.message}`); - } + } await conn.query(updateQuery, ['printed', null, jobId]); this.jobLog(jobId, 'log', `${jobData.report}: '${printCommand}': GET ${url}`); @@ -302,7 +304,6 @@ class PrintServer { if (index !== -1) this.jobs.splice(index, 1); setTimeout(() => this.getJobs()); } - } jobLog(jobId, realm, message) { this.log(`Job[${colors.yellow(jobId)}]`, realm, message);