Skip to content

Commit 745e8b5

Browse files
add jobLogs to error handler
1 parent 78953af commit 745e8b5

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

bull/pdl-queue/consumer.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,26 +117,26 @@ async function uploadToIA(zip, metadata, byteLength, email, job) {
117117
}
118118

119119
PDLQueue.process(async (job, done) => {
120+
const jobLogs = job.data.details;
121+
const trueURI = `http://archive.org/details/${job.data.details.IAIdentifier}`;
122+
jobLogs["trueURI"] = trueURI;
123+
jobLogs["userName"] = job.data.details.userName;
120124
const [zip, byteLength, isError] = await getZipAndBytelength(
121125
job.data.details.Pages,
122126
job.data.details.bookID,
123127
job.data.details.title,
124128
job
125129
);
126-
127130
if (isError) {
131+
job.log(JSON.stringify(jobLogs));
132+
logUserData(jobLogs["userName"], "Panjab Digital Library");
128133
logger.log({
129134
level: "error",
130135
message: `PDL Failure PDL Server failed to return images`,
131136
});
132-
done(new Error("PDL Server failed to return images"));
133137
job.progress(100);
134-
done(null, false);
138+
done(new Error("PDL Server failed to return images"));
135139
} else {
136-
const jobLogs = job.data.details;
137-
const trueURI = `http://archive.org/details/${job.data.details.IAIdentifier}`;
138-
jobLogs["trueURI"] = trueURI;
139-
jobLogs["userName"] = job.data.details.userName;
140140
job.log(JSON.stringify(jobLogs));
141141
logUserData(jobLogs["userName"], "Panjab Digital Library");
142142
job.progress(90);

0 commit comments

Comments
 (0)