mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-06-05 03:16:29 +00:00
fix: report unexpected cache save failures (#896)
## Summary - add top-level uncaughtException and unhandledRejection handlers for the save-cache entrypoint - report unexpected post-action failures through core.setFailed with stack/context - regenerate the committed save-cache bundle
This commit is contained in:
committed by
GitHub
parent
feda7fc6a9
commit
818affc359
16
dist/save-cache/index.cjs
generated
vendored
16
dist/save-cache/index.cjs
generated
vendored
@@ -63211,6 +63211,22 @@ function getResolutionStrategy() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// src/save-cache.ts
|
// src/save-cache.ts
|
||||||
|
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 run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
const inputs = loadInputs();
|
const inputs = loadInputs();
|
||||||
|
|||||||
@@ -11,6 +11,26 @@ import {
|
|||||||
import { STATE_UV_PATH, STATE_UV_VERSION } from "./utils/constants";
|
import { STATE_UV_PATH, STATE_UV_VERSION } from "./utils/constants";
|
||||||
import { loadInputs, type SetupInputs } from "./utils/inputs";
|
import { loadInputs, type SetupInputs } from "./utils/inputs";
|
||||||
|
|
||||||
|
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);
|
||||||
|
});
|
||||||
|
|
||||||
export async function run(): Promise<void> {
|
export async function run(): Promise<void> {
|
||||||
try {
|
try {
|
||||||
const inputs = loadInputs();
|
const inputs = loadInputs();
|
||||||
|
|||||||
Reference in New Issue
Block a user