Skip to content

Commit 78953af

Browse files
check for 2xx and handle all error codes
1 parent 8e3af72 commit 78953af

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bull/pdl-queue/consumer.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@ async function getZipAndBytelength(no_of_pages, id, title, job) {
5454
downloadImageStatus = await download_image(str, `${title}_${i}.jpeg`);
5555
job.progress(Math.round((i / temp_pages) * 82));
5656
}
57-
let isError = downloadImageStatus === 500 ? true : false;
57+
let isError =
58+
downloadImageStatus >= 200 && downloadImageStatus < 300 ? false : true;
5859
let { byteLength } = await zip.generateAsync({ type: "nodebuffer" });
5960
byteLength = Number(byteLength + no_of_pages * 16); //No. of pages * 16
6061
return [zip, byteLength, isError];

0 commit comments

Comments
 (0)