Skip to content

Commit

Permalink
catch error
Browse files Browse the repository at this point in the history
  • Loading branch information
katiegoines committed Mar 18, 2024
1 parent 99a9fe0 commit 995664c
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions tasks/console-errors.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,16 @@ const consoleErrors = async (domain) => {
let pagesToCheck = await getSitemapUrls(domain);
let errorMessage = '';
for (let i = 0; i < pagesToCheck.length; i++) {
let url = pagesToCheck[i];
console.log(`checking page ${url}`);
let errorsFound = await checkPage(url);
errorsFound.forEach((error) => {
errorMessage += `${error.message} found on ${error.page}\n`;
});
try {
let url = pagesToCheck[i];
console.log(`checking page ${url}`);
let errorsFound = await checkPage(url);
errorsFound.forEach((error) => {
errorMessage += `${error.message} found on ${error.page}\n`;
});
} catch (error) {
console.log(error);
}
}
console.log(errorMessage);
return errorMessage;
Expand Down

0 comments on commit 995664c

Please sign in to comment.