Skip to content

Commit

Permalink
feat: Allow validation errors to be ignored when debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
nickevansuk committed Nov 13, 2024
1 parent 1b3f005 commit e1ce64e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/harvest-rpde.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ async function baseHarvestRPDE({
options: { multibar, pauseResume } = { multibar: null, pauseResume: null },
}, isLosslessMode = false) {
const stopMultibar = () => {
// TODO: To prevent extraneous output, ensure that multibar.stop is only called if the multibar is already active (e.g. by wrapping the multibar to allow us to set it to null when not in use)
// Ensure that the multibar is stopped only if it has not already been stopped (to prevent extraneous output)
// TODO: Ensure that multibar.stop is only called if the multibar is already active (e.g. by wrapping the multibar to allow us to set it to null when not in use)
if (multibar) multibar.stop();
};
const pageDescriptiveIdentifier = (url, headers) => `RPDE feed ${feedContextIdentifier} page "${url}" (request headers: ${JSON.stringify(headers)})`;
Expand Down Expand Up @@ -126,8 +127,10 @@ async function baseHarvestRPDE({
stopMultibar();
logErrorDuringHarvest(`\nFATAL ERROR: RPDE Validation Error(s) found on ${pageDescriptiveIdentifier(url, headersForThisRequest)}:\n${rpdeValidationErrors.map(error => `- ${error.message.split('\n')[0]}`).join('\n')}\n`);
// TODO: Provide context to the error callback
onError();
return;
if (process.env.DEBUG_IGNORE_RPDE_VALIDATION_ERRORS !== 'true') {
onError();
return;
}
}

const json = isLosslessMode ? response.data.highFidelityData : response.data.lowFidelityData;
Expand Down

0 comments on commit e1ce64e

Please sign in to comment.