mirror of
https://github.com/astral-sh/setup-uv.git
synced 2026-06-28 10:45:08 +00:00
fix: report unexpected setup failures
This commit is contained in:
parent
8dc20b2aca
commit
d532b42787
2 changed files with 36 additions and 0 deletions
16
dist/setup/index.cjs
generated
vendored
16
dist/setup/index.cjs
generated
vendored
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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<string> {
|
||||
if (inputs.pythonVersion !== "") {
|
||||
return inputs.pythonVersion;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue