Logging for timeout info, and adds key to map

This commit is contained in:
Alicia Sykes 2024-03-20 20:45:13 +00:00
parent c764bbfcd4
commit 7a8e694abc

View file

@ -208,12 +208,24 @@ const Results = (): JSX.Element => {
console.log(
`%cFetch Error - ${job}%c\n\n${timeString}%c The ${job} job failed `
+`after ${timeTaken}ms, with the following error:%c\n${error}`,
`background: ${colors.danger}; padding: 4px 8px; font-size: 16px;`,
`background: ${colors.danger}; color:${colors.background}; padding: 4px 8px; font-size: 16px;`,
`font-weight: bold; color: ${colors.danger};`,
`color: ${colors.danger};`,
`color: ${colors.warning};`,
);
}
if (newState === 'timed-out') {
console.log(
`%cFetch Timeout - ${job}%c\n\n${timeString}%c The ${job} job timed out `
+`after ${timeTaken}ms, with the following error:%c\n${error}`,
`background: ${colors.info}; color:${colors.background}; padding: 4px 8px; font-size: 16px;`,
`font-weight: bold; color: ${colors.info};`,
`color: ${colors.info};`,
`color: ${colors.warning};`,
);
}
return newJobs;
});
});
@ -225,8 +237,9 @@ const Results = (): JSX.Element => {
.then(data => resolve(data))
.catch(error => resolve(
{ error: `Failed to get a valid response 😢\n`
+ `This is likely due the target not exposing the required data, `
+ `or limitations in how Netlify executes lambda functions, such as the 10-sec timeout.\n\n`
+ 'This is likely due the target not exposing the required data, '
+ 'or limitations in imposed by the infrastructure this instance '
+ 'of Web Check is running on.\n\n'
+ `Error info:\n${error}`}
));
});
@ -910,7 +923,7 @@ const Results = (): JSX.Element => {
&& title.toLowerCase().includes(searchTerm.toLowerCase())
&& (result && !result.error);
return show ? (
<ErrorBoundary title={title}>
<ErrorBoundary title={title} key={`eb-${index}`}>
<Component
key={`${title}-${index}`}
data={{...result}}