Skip to content

Commit

Permalink
Exit (error) codes 1 and "Z" should really be treated as warnings and…
Browse files Browse the repository at this point in the history
… a PDF will have been generated - see wkhtmltopdf/wkhtmltopdf#1502 (comment).
  • Loading branch information
favill42 committed Sep 21, 2021
1 parent 376358d commit d34c5fb
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion utils/wkhtmltopdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,26 @@ module.exports = function (html, options = []) {
reject(error);
}).on("exit", code => {
if (code) {
reject(new Error(`wkhtmltopdf process exited with code ${code}`));
/*
https://github.com/wkhtmltopdf/wkhtmltopdf/issues/1502#issuecomment-35705833
0 All OK
1 PDF generated OK, but some request(s) did not return HTTP 200
2 Could not something something
X Could not write PDF: File in use
Y Could not write PDF: No write permission
Z PDF generated OK, but some JavaScript requests(s) timeouted
A Invalid arguments provided
B Could not find input file(s)
C Process timeout
*/

if (code === 1 || code === "Z") {
resolve(Buffer.concat(bufs));
}
else {
reject(new Error(`wkhtmltopdf process exited with code ${code}`));
}
} else {
resolve(Buffer.concat(bufs));
}
Expand Down

0 comments on commit d34c5fb

Please sign in to comment.