From 529c266223a58cd393dfc219b43361393a51887f Mon Sep 17 00:00:00 2001 From: Henry Mercer Date: Fri, 23 Jan 2026 10:36:25 +0000 Subject: [PATCH] Use `getErrorMessage` in more places --- lib/analyze-action.js | 8 +++++--- lib/autobuild-action.js | 8 +++++--- lib/init-action-post.js | 8 +++++--- lib/init-action.js | 8 +++++--- lib/resolve-environment-action.js | 8 +++++--- lib/setup-codeql-action.js | 8 +++++--- lib/start-proxy-action.js | 8 +++++--- lib/upload-sarif-action.js | 8 +++++--- src/status-report.ts | 8 +++++--- 9 files changed, 45 insertions(+), 27 deletions(-) diff --git a/lib/analyze-action.js b/lib/analyze-action.js index c8bd4aed0..e45e67a6a 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -94309,7 +94309,9 @@ async function createStatusReportBase(actionName, status, actionStartedAt, confi try { statusReport.actions_event_name = getWorkflowEventName(); } catch (e) { - logger.warning(`Could not determine the workflow event name: ${e}.`); + logger.warning( + `Could not determine the workflow event name: ${getErrorMessage(e)}.` + ); } if (config) { statusReport.languages = config.languages?.join(","); @@ -94347,7 +94349,7 @@ async function createStatusReportBase(actionName, status, actionStartedAt, confi return statusReport; } catch (e) { logger.warning( - `Caught an exception while gathering information for telemetry: ${e}. Will skip sending status report.` + `Failed to gather information for telemetry: ${getErrorMessage(e)}. Will skip sending status report.` ); if (isInTestMode()) { throw e; @@ -94427,7 +94429,7 @@ async function sendUnhandledErrorStatusReport(actionName, actionStartedAt, error } } catch (e) { logger.warning( - `Caught an exception while sending the error status report: ${e}.` + `Failed to send the error status report: ${getErrorMessage(e)}.` ); } } diff --git a/lib/autobuild-action.js b/lib/autobuild-action.js index 09722eb20..57885eac3 100644 --- a/lib/autobuild-action.js +++ b/lib/autobuild-action.js @@ -88781,7 +88781,9 @@ async function createStatusReportBase(actionName, status, actionStartedAt, confi try { statusReport.actions_event_name = getWorkflowEventName(); } catch (e) { - logger.warning(`Could not determine the workflow event name: ${e}.`); + logger.warning( + `Could not determine the workflow event name: ${getErrorMessage(e)}.` + ); } if (config) { statusReport.languages = config.languages?.join(","); @@ -88819,7 +88821,7 @@ async function createStatusReportBase(actionName, status, actionStartedAt, confi return statusReport; } catch (e) { logger.warning( - `Caught an exception while gathering information for telemetry: ${e}. Will skip sending status report.` + `Failed to gather information for telemetry: ${getErrorMessage(e)}. Will skip sending status report.` ); if (isInTestMode()) { throw e; @@ -88899,7 +88901,7 @@ async function sendUnhandledErrorStatusReport(actionName, actionStartedAt, error } } catch (e) { logger.warning( - `Caught an exception while sending the error status report: ${e}.` + `Failed to send the error status report: ${getErrorMessage(e)}.` ); } } diff --git a/lib/init-action-post.js b/lib/init-action-post.js index 9bc9c637f..5034549b0 100644 --- a/lib/init-action-post.js +++ b/lib/init-action-post.js @@ -130672,7 +130672,9 @@ async function createStatusReportBase(actionName, status, actionStartedAt, confi try { statusReport.actions_event_name = getWorkflowEventName(); } catch (e) { - logger.warning(`Could not determine the workflow event name: ${e}.`); + logger.warning( + `Could not determine the workflow event name: ${getErrorMessage(e)}.` + ); } if (config) { statusReport.languages = config.languages?.join(","); @@ -130710,7 +130712,7 @@ async function createStatusReportBase(actionName, status, actionStartedAt, confi return statusReport; } catch (e) { logger.warning( - `Caught an exception while gathering information for telemetry: ${e}. Will skip sending status report.` + `Failed to gather information for telemetry: ${getErrorMessage(e)}. Will skip sending status report.` ); if (isInTestMode()) { throw e; @@ -130790,7 +130792,7 @@ async function sendUnhandledErrorStatusReport(actionName, actionStartedAt, error } } catch (e) { logger.warning( - `Caught an exception while sending the error status report: ${e}.` + `Failed to send the error status report: ${getErrorMessage(e)}.` ); } } diff --git a/lib/init-action.js b/lib/init-action.js index 382979c84..67df79fef 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -92100,7 +92100,9 @@ async function createStatusReportBase(actionName, status, actionStartedAt, confi try { statusReport.actions_event_name = getWorkflowEventName(); } catch (e) { - logger.warning(`Could not determine the workflow event name: ${e}.`); + logger.warning( + `Could not determine the workflow event name: ${getErrorMessage(e)}.` + ); } if (config) { statusReport.languages = config.languages?.join(","); @@ -92138,7 +92140,7 @@ async function createStatusReportBase(actionName, status, actionStartedAt, confi return statusReport; } catch (e) { logger.warning( - `Caught an exception while gathering information for telemetry: ${e}. Will skip sending status report.` + `Failed to gather information for telemetry: ${getErrorMessage(e)}. Will skip sending status report.` ); if (isInTestMode()) { throw e; @@ -92264,7 +92266,7 @@ async function sendUnhandledErrorStatusReport(actionName, actionStartedAt, error } } catch (e) { logger.warning( - `Caught an exception while sending the error status report: ${e}.` + `Failed to send the error status report: ${getErrorMessage(e)}.` ); } } diff --git a/lib/resolve-environment-action.js b/lib/resolve-environment-action.js index 86069a98a..032e47b97 100644 --- a/lib/resolve-environment-action.js +++ b/lib/resolve-environment-action.js @@ -88401,7 +88401,9 @@ async function createStatusReportBase(actionName, status, actionStartedAt, confi try { statusReport.actions_event_name = getWorkflowEventName(); } catch (e) { - logger.warning(`Could not determine the workflow event name: ${e}.`); + logger.warning( + `Could not determine the workflow event name: ${getErrorMessage(e)}.` + ); } if (config) { statusReport.languages = config.languages?.join(","); @@ -88439,7 +88441,7 @@ async function createStatusReportBase(actionName, status, actionStartedAt, confi return statusReport; } catch (e) { logger.warning( - `Caught an exception while gathering information for telemetry: ${e}. Will skip sending status report.` + `Failed to gather information for telemetry: ${getErrorMessage(e)}. Will skip sending status report.` ); if (isInTestMode()) { throw e; @@ -88519,7 +88521,7 @@ async function sendUnhandledErrorStatusReport(actionName, actionStartedAt, error } } catch (e) { logger.warning( - `Caught an exception while sending the error status report: ${e}.` + `Failed to send the error status report: ${getErrorMessage(e)}.` ); } } diff --git a/lib/setup-codeql-action.js b/lib/setup-codeql-action.js index 4385b012c..100459b82 100644 --- a/lib/setup-codeql-action.js +++ b/lib/setup-codeql-action.js @@ -89728,7 +89728,9 @@ async function createStatusReportBase(actionName, status, actionStartedAt, confi try { statusReport.actions_event_name = getWorkflowEventName(); } catch (e) { - logger.warning(`Could not determine the workflow event name: ${e}.`); + logger.warning( + `Could not determine the workflow event name: ${getErrorMessage(e)}.` + ); } if (config) { statusReport.languages = config.languages?.join(","); @@ -89766,7 +89768,7 @@ async function createStatusReportBase(actionName, status, actionStartedAt, confi return statusReport; } catch (e) { logger.warning( - `Caught an exception while gathering information for telemetry: ${e}. Will skip sending status report.` + `Failed to gather information for telemetry: ${getErrorMessage(e)}. Will skip sending status report.` ); if (isInTestMode()) { throw e; @@ -89846,7 +89848,7 @@ async function sendUnhandledErrorStatusReport(actionName, actionStartedAt, error } } catch (e) { logger.warning( - `Caught an exception while sending the error status report: ${e}.` + `Failed to send the error status report: ${getErrorMessage(e)}.` ); } } diff --git a/lib/start-proxy-action.js b/lib/start-proxy-action.js index 21a7e0341..aba9e48bb 100644 --- a/lib/start-proxy-action.js +++ b/lib/start-proxy-action.js @@ -104565,7 +104565,9 @@ async function createStatusReportBase(actionName, status, actionStartedAt, confi try { statusReport.actions_event_name = getWorkflowEventName(); } catch (e) { - logger.warning(`Could not determine the workflow event name: ${e}.`); + logger.warning( + `Could not determine the workflow event name: ${getErrorMessage(e)}.` + ); } if (config) { statusReport.languages = config.languages?.join(","); @@ -104603,7 +104605,7 @@ async function createStatusReportBase(actionName, status, actionStartedAt, confi return statusReport; } catch (e) { logger.warning( - `Caught an exception while gathering information for telemetry: ${e}. Will skip sending status report.` + `Failed to gather information for telemetry: ${getErrorMessage(e)}. Will skip sending status report.` ); if (isInTestMode()) { throw e; @@ -104683,7 +104685,7 @@ async function sendUnhandledErrorStatusReport(actionName, actionStartedAt, error } } catch (e) { logger.warning( - `Caught an exception while sending the error status report: ${e}.` + `Failed to send the error status report: ${getErrorMessage(e)}.` ); } } diff --git a/lib/upload-sarif-action.js b/lib/upload-sarif-action.js index c2d42c4f0..61826c285 100644 --- a/lib/upload-sarif-action.js +++ b/lib/upload-sarif-action.js @@ -90958,7 +90958,9 @@ async function createStatusReportBase(actionName, status, actionStartedAt, confi try { statusReport.actions_event_name = getWorkflowEventName(); } catch (e) { - logger.warning(`Could not determine the workflow event name: ${e}.`); + logger.warning( + `Could not determine the workflow event name: ${getErrorMessage(e)}.` + ); } if (config) { statusReport.languages = config.languages?.join(","); @@ -90996,7 +90998,7 @@ async function createStatusReportBase(actionName, status, actionStartedAt, confi return statusReport; } catch (e) { logger.warning( - `Caught an exception while gathering information for telemetry: ${e}. Will skip sending status report.` + `Failed to gather information for telemetry: ${getErrorMessage(e)}. Will skip sending status report.` ); if (isInTestMode()) { throw e; @@ -91076,7 +91078,7 @@ async function sendUnhandledErrorStatusReport(actionName, actionStartedAt, error } } catch (e) { logger.warning( - `Caught an exception while sending the error status report: ${e}.` + `Failed to send the error status report: ${getErrorMessage(e)}.` ); } } diff --git a/src/status-report.ts b/src/status-report.ts index 513cdb43e..8b9b3a3a9 100644 --- a/src/status-report.ts +++ b/src/status-report.ts @@ -321,7 +321,9 @@ export async function createStatusReportBase( try { statusReport.actions_event_name = getWorkflowEventName(); } catch (e) { - logger.warning(`Could not determine the workflow event name: ${e}.`); + logger.warning( + `Could not determine the workflow event name: ${getErrorMessage(e)}.`, + ); } if (config) { @@ -374,7 +376,7 @@ export async function createStatusReportBase( return statusReport; } catch (e) { logger.warning( - `Caught an exception while gathering information for telemetry: ${e}. Will skip sending status report.`, + `Failed to gather information for telemetry: ${getErrorMessage(e)}. Will skip sending status report.`, ); // Re-throw the exception in test mode. While testing, we want to know if something goes wrong here. @@ -629,7 +631,7 @@ export async function sendUnhandledErrorStatusReport( } } catch (e) { logger.warning( - `Caught an exception while sending the error status report: ${e}.`, + `Failed to send the error status report: ${getErrorMessage(e)}.`, ); } }