diff --git a/dist/index.js b/dist/index.js index c7b396f..d0c2fbf 100644 --- a/dist/index.js +++ b/dist/index.js @@ -13285,7 +13285,7 @@ const fs = __importStar(__nccwpck_require__(7147)); const compare_versions_1 = __nccwpck_require__(4773); // compareVersions can be used in the sense of > // Don't throw on non-zero. const exec = async (cmd, args) => (0, exec_1.exec)(cmd, args, { ignoreReturnCode: true }); -function failed(tool, version) { +async function failed(tool, version) { throw new Error(`All install methods for ${tool} ${version} failed`); } async function configureOutputs(tool, version, path, os) { @@ -13731,7 +13731,7 @@ function parseYAMLBoolean(name, val) { exports.parseYAMLBoolean = parseYAMLBoolean; function parseURL(name, val) { if (val === '') - return undefined; + return null; try { return new URL(val); } diff --git a/lib/installer.js b/lib/installer.js index 798b54f..3902a03 100644 --- a/lib/installer.js +++ b/lib/installer.js @@ -40,7 +40,7 @@ const fs = __importStar(require("fs")); const compare_versions_1 = require("compare-versions"); // compareVersions can be used in the sense of > // Don't throw on non-zero. const exec = async (cmd, args) => (0, exec_1.exec)(cmd, args, { ignoreReturnCode: true }); -function failed(tool, version) { +async function failed(tool, version) { throw new Error(`All install methods for ${tool} ${version} failed`); } async function configureOutputs(tool, version, path, os) { diff --git a/src/installer.ts b/src/installer.ts index 9d30f41..1b682fb 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -14,7 +14,7 @@ import {compareVersions} from 'compare-versions'; // compareVersions can be used const exec = async (cmd: string, args?: string[]): Promise => e(cmd, args, {ignoreReturnCode: true}); -function failed(tool: Tool, version: string): void { +async function failed(tool: Tool, version: string): Promise { throw new Error(`All install methods for ${tool} ${version} failed`); } diff --git a/src/opts.ts b/src/opts.ts index 9fe2dc1..7818af5 100644 --- a/src/opts.ts +++ b/src/opts.ts @@ -24,7 +24,7 @@ export interface ProgramOpt { export interface Options { ghc: ProgramOpt; - ghcup: {releaseChannel?: URL}; + ghcup: {releaseChannel: URL | null}; cabal: ProgramOpt & {update: boolean}; stack: ProgramOpt & {setup: boolean}; general: {matcher: {enable: boolean}}; @@ -138,8 +138,8 @@ export function parseYAMLBoolean(name: string, val: string): boolean { ); } -export function parseURL(name: string, val: string): URL | undefined { - if (val === '') return undefined; +export function parseURL(name: string, val: string): URL | null { + if (val === '') return null; try { return new URL(val); } catch (e) {