From e1ce64ec1f5824cabb685179aaf1e773ae77a2b1 Mon Sep 17 00:00:00 2001 From: Nick Evans <2616208+nickevansuk@users.noreply.github.com> Date: Wed, 13 Nov 2024 14:18:52 +0000 Subject: [PATCH 1/2] feat: Allow validation errors to be ignored when debugging --- src/harvest-rpde.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/harvest-rpde.js b/src/harvest-rpde.js index 8c27a83..db91110 100644 --- a/src/harvest-rpde.js +++ b/src/harvest-rpde.js @@ -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)})`; @@ -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; From b3046d9fd0382b4ca0559f0d6de2d9f833d3a6ec Mon Sep 17 00:00:00 2001 From: Nick Evans <2616208+nickevansuk@users.noreply.github.com> Date: Wed, 13 Nov 2024 14:38:21 +0000 Subject: [PATCH 2/2] Fix accidental commit --- src/harvest-rpde.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/harvest-rpde.js b/src/harvest-rpde.js index db91110..251d22e 100644 --- a/src/harvest-rpde.js +++ b/src/harvest-rpde.js @@ -42,8 +42,7 @@ async function baseHarvestRPDE({ options: { multibar, pauseResume } = { multibar: null, pauseResume: null }, }, isLosslessMode = false) { const stopMultibar = () => { - // 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) + // 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) if (multibar) multibar.stop(); }; const pageDescriptiveIdentifier = (url, headers) => `RPDE feed ${feedContextIdentifier} page "${url}" (request headers: ${JSON.stringify(headers)})`;