Skip to content

Commit 36a551c

Browse files
micahbulemarcbachmann
authored andcommitted
Fixed error handling
1 parent 4e15719 commit 36a551c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/pdf.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ PDF.prototype.exec = function PdfExec (callback) {
121121
// Ignore if code has a value of 0 since that means PhantomJS has executed and exited successfully.
122122
// Also, as per your script and standards, having a code value of 1 means one can always assume that
123123
// an error occured.
124-
if ((typeof code !== 'undefined' && code !== null) && code !== 0) {
124+
if (((typeof code !== 'undefined' && code !== null) && code !== 0) || err) {
125125
var error = null
126126

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

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

139139
return callback(error)
140140
}

0 commit comments

Comments
 (0)