Skip to content

Commit

Permalink
Fixed error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
micahbule authored and marcbachmann committed May 15, 2019
1 parent 4e15719 commit 36a551c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ PDF.prototype.exec = function PdfExec (callback) {
// Ignore if code has a value of 0 since that means PhantomJS has executed and exited successfully.
// Also, as per your script and standards, having a code value of 1 means one can always assume that
// an error occured.
if ((typeof code !== 'undefined' && code !== null) && code !== 0) {
if (((typeof code !== 'undefined' && code !== null) && code !== 0) || err) {
var error = null

if (err) {
Expand All @@ -134,7 +134,7 @@ PDF.prototype.exec = function PdfExec (callback) {

// Append anything caught from the stderr
var postfix = stderr.length ? '\n' + Buffer.concat(stderr).toString() : ''
if (postfix) err.message += postfix
if (postfix) error.message += postfix

return callback(error)
}
Expand Down

0 comments on commit 36a551c

Please sign in to comment.