From feda7fc6a923e569eb1b68954942b479114fc7c0 Mon Sep 17 00:00:00 2001 From: Kevin Stillhammer Date: Sun, 31 May 2026 11:17:46 +0200 Subject: [PATCH] fix: report unexpected setup failures (#895) ## Summary - add top-level uncaughtException and unhandledRejection handlers for the setup entrypoint - report unexpected failures through core.setFailed with stack/context - regenerate the committed setup bundle --- dist/setup/index.cjs | 16 ++++++++++++++++ src/setup-uv.ts | 20 ++++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/dist/setup/index.cjs b/dist/setup/index.cjs index 16b28cc..5d0c9ef 100644 --- a/dist/setup/index.cjs +++ b/dist/setup/index.cjs @@ -97406,6 +97406,22 @@ function getResolutionStrategy() { // src/setup-uv.ts var sourceDir = __dirname; +function formatUnexpectedFailure(error2) { + if (error2 instanceof Error) { + return error2.stack ?? error2.message; + } + return String(error2); +} +function failUnexpectedly(event, error2) { + setFailed(`${event}: ${formatUnexpectedFailure(error2)}`); + process.exit(1); +} +process.on("uncaughtException", (error2) => { + failUnexpectedly("Uncaught exception", error2); +}); +process.on("unhandledRejection", (reason) => { + failUnexpectedly("Unhandled promise rejection", reason); +}); async function getPythonVersion(inputs) { if (inputs.pythonVersion !== "") { return inputs.pythonVersion; diff --git a/src/setup-uv.ts b/src/setup-uv.ts index f2bf3bf..1c30eaa 100644 --- a/src/setup-uv.ts +++ b/src/setup-uv.ts @@ -19,6 +19,26 @@ import { resolveUvVersion } from "./version/resolve"; const sourceDir = __dirname; +function formatUnexpectedFailure(error: unknown): string { + if (error instanceof Error) { + return error.stack ?? error.message; + } + return String(error); +} + +function failUnexpectedly(event: string, error: unknown): never { + core.setFailed(`${event}: ${formatUnexpectedFailure(error)}`); + process.exit(1); +} + +process.on("uncaughtException", (error) => { + failUnexpectedly("Uncaught exception", error); +}); + +process.on("unhandledRejection", (reason) => { + failUnexpectedly("Unhandled promise rejection", reason); +}); + async function getPythonVersion(inputs: SetupInputs): Promise { if (inputs.pythonVersion !== "") { return inputs.pythonVersion;