diff --git a/lib/analyze-action.js b/lib/analyze-action.js index 9bfae0b60..cb078b4ef 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -94426,11 +94426,18 @@ async function sendUnhandledErrorStatusReport(actionName, actionStartedAt, error ); if (statusReport !== void 0) { await sendStatusReport(statusReport); + } else if (isInTestMode()) { + throw new Error( + "Failed to create status report for unhandled error in test mode." + ); } } catch (e) { logger.warning( `Failed to send the error status report: ${getErrorMessage(e)}.` ); + if (isInTestMode()) { + throw e; + } } } diff --git a/lib/autobuild-action.js b/lib/autobuild-action.js index a04c64286..842960f50 100644 --- a/lib/autobuild-action.js +++ b/lib/autobuild-action.js @@ -88898,11 +88898,18 @@ async function sendUnhandledErrorStatusReport(actionName, actionStartedAt, error ); if (statusReport !== void 0) { await sendStatusReport(statusReport); + } else if (isInTestMode()) { + throw new Error( + "Failed to create status report for unhandled error in test mode." + ); } } catch (e) { logger.warning( `Failed to send the error status report: ${getErrorMessage(e)}.` ); + if (isInTestMode()) { + throw e; + } } } diff --git a/lib/init-action-post.js b/lib/init-action-post.js index dd4513a9b..3d6a7deb3 100644 --- a/lib/init-action-post.js +++ b/lib/init-action-post.js @@ -130789,11 +130789,18 @@ async function sendUnhandledErrorStatusReport(actionName, actionStartedAt, error ); if (statusReport !== void 0) { await sendStatusReport(statusReport); + } else if (isInTestMode()) { + throw new Error( + "Failed to create status report for unhandled error in test mode." + ); } } catch (e) { logger.warning( `Failed to send the error status report: ${getErrorMessage(e)}.` ); + if (isInTestMode()) { + throw e; + } } } diff --git a/lib/init-action.js b/lib/init-action.js index 12c7c73cf..e1e3adc6e 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -92263,11 +92263,18 @@ async function sendUnhandledErrorStatusReport(actionName, actionStartedAt, error ); if (statusReport !== void 0) { await sendStatusReport(statusReport); + } else if (isInTestMode()) { + throw new Error( + "Failed to create status report for unhandled error in test mode." + ); } } catch (e) { logger.warning( `Failed to send the error status report: ${getErrorMessage(e)}.` ); + if (isInTestMode()) { + throw e; + } } } diff --git a/lib/resolve-environment-action.js b/lib/resolve-environment-action.js index dc3903dc7..67d710d89 100644 --- a/lib/resolve-environment-action.js +++ b/lib/resolve-environment-action.js @@ -88518,11 +88518,18 @@ async function sendUnhandledErrorStatusReport(actionName, actionStartedAt, error ); if (statusReport !== void 0) { await sendStatusReport(statusReport); + } else if (isInTestMode()) { + throw new Error( + "Failed to create status report for unhandled error in test mode." + ); } } catch (e) { logger.warning( `Failed to send the error status report: ${getErrorMessage(e)}.` ); + if (isInTestMode()) { + throw e; + } } } diff --git a/lib/setup-codeql-action.js b/lib/setup-codeql-action.js index a31eac0fe..59605c1fb 100644 --- a/lib/setup-codeql-action.js +++ b/lib/setup-codeql-action.js @@ -89845,11 +89845,18 @@ async function sendUnhandledErrorStatusReport(actionName, actionStartedAt, error ); if (statusReport !== void 0) { await sendStatusReport(statusReport); + } else if (isInTestMode()) { + throw new Error( + "Failed to create status report for unhandled error in test mode." + ); } } catch (e) { logger.warning( `Failed to send the error status report: ${getErrorMessage(e)}.` ); + if (isInTestMode()) { + throw e; + } } } diff --git a/lib/start-proxy-action.js b/lib/start-proxy-action.js index eb5f9a8f6..7a3f66e74 100644 --- a/lib/start-proxy-action.js +++ b/lib/start-proxy-action.js @@ -104682,11 +104682,18 @@ async function sendUnhandledErrorStatusReport(actionName, actionStartedAt, error ); if (statusReport !== void 0) { await sendStatusReport(statusReport); + } else if (isInTestMode()) { + throw new Error( + "Failed to create status report for unhandled error in test mode." + ); } } catch (e) { logger.warning( `Failed to send the error status report: ${getErrorMessage(e)}.` ); + if (isInTestMode()) { + throw e; + } } } diff --git a/lib/upload-sarif-action.js b/lib/upload-sarif-action.js index 7857564f5..e5fc6230a 100644 --- a/lib/upload-sarif-action.js +++ b/lib/upload-sarif-action.js @@ -91075,11 +91075,18 @@ async function sendUnhandledErrorStatusReport(actionName, actionStartedAt, error ); if (statusReport !== void 0) { await sendStatusReport(statusReport); + } else if (isInTestMode()) { + throw new Error( + "Failed to create status report for unhandled error in test mode." + ); } } catch (e) { logger.warning( `Failed to send the error status report: ${getErrorMessage(e)}.` ); + if (isInTestMode()) { + throw e; + } } } diff --git a/src/status-report.ts b/src/status-report.ts index 30b50e83d..532e692f0 100644 --- a/src/status-report.ts +++ b/src/status-report.ts @@ -630,10 +630,17 @@ export async function sendUnhandledErrorStatusReport( ); if (statusReport !== undefined) { await sendStatusReport(statusReport); + } else if (isInTestMode()) { + throw new Error( + "Failed to create status report for unhandled error in test mode.", + ); } } catch (e) { logger.warning( `Failed to send the error status report: ${getErrorMessage(e)}.`, ); + if (isInTestMode()) { + throw e; + } } }