From 7a8e694abcfcb0af4e3f6839d5b5c1c50db1dcf7 Mon Sep 17 00:00:00 2001 From: Alicia Sykes Date: Wed, 20 Mar 2024 20:45:13 +0000 Subject: [PATCH] Logging for timeout info, and adds key to map --- src/pages/Results.tsx | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/pages/Results.tsx b/src/pages/Results.tsx index 3190287..a74c4a8 100644 --- a/src/pages/Results.tsx +++ b/src/pages/Results.tsx @@ -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 ? ( - +