From 85cbcd387e16ebba6636518fca47f0517e45b4bf Mon Sep 17 00:00:00 2001 From: Sascha Mann Date: Sun, 5 Jul 2020 14:02:28 +0200 Subject: [PATCH] Fix error throwing throw 'error' does not display an error message on GitHub Actions anymore. --- lib/installer.js | 12 ++++++------ src/installer.ts | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/installer.js b/lib/installer.js index 4267fb6..88fef1d 100644 --- a/lib/installer.js +++ b/lib/installer.js @@ -38,7 +38,7 @@ function getJuliaVersion(availableReleases, versionInput) { // Use the highest available version that matches versionInput let version = semver.maxSatisfying(availableReleases, versionInput); if (version == null) { - throw `Could not find a Julia version that matches ${versionInput}`; + throw new Error(`Could not find a Julia version that matches ${versionInput}`); } // GitHub tags start with v, remove it version = version.replace(/^v/, ''); @@ -55,7 +55,7 @@ function getDownloadURL(version, arch) { } else if (osPlat === 'darwin') { // macOS if (arch == 'x86') { - throw '32-bit Julia is not available on macOS'; + throw new Error('32-bit Julia is not available on macOS'); } platform = 'mac'; } @@ -63,7 +63,7 @@ function getDownloadURL(version, arch) { platform = 'linux'; } else { - throw `Platform ${osPlat} is not supported`; + throw new Error(`Platform ${osPlat} is not supported`); } // nightlies if (version == 'nightly') { @@ -83,7 +83,7 @@ function getFileName(version, arch) { } else if (osPlat === 'darwin') { // macOS if (arch == 'x86') { - throw '32-bit Julia is not available on macOS'; + throw new Error('32-bit Julia is not available on macOS'); } versionExt = '-mac64'; ext = 'dmg'; @@ -98,7 +98,7 @@ function getFileName(version, arch) { ext = 'tar.gz'; } else { - throw `Platform ${osPlat} is not supported`; + throw new Error(`Platform ${osPlat} is not supported`); } return `julia-${version}${versionExt}.${ext}`; } @@ -131,7 +131,7 @@ function installJulia(version, arch) { yield exec.exec('/bin/bash', ['-c', `cp -a /Volumes/Julia-*/Julia-*.app/Contents/Resources/julia ${process.env.HOME}`]); return `${process.env.HOME}/julia`; default: - throw `Platform ${osPlat} is not supported`; + throw new Error(`Platform ${osPlat} is not supported`); } }); } diff --git a/src/installer.ts b/src/installer.ts index 9bcc7e3..51a019d 100644 --- a/src/installer.ts +++ b/src/installer.ts @@ -28,7 +28,7 @@ export function getJuliaVersion(availableReleases: string[], versionInput: strin // Use the highest available version that matches versionInput let version = semver.maxSatisfying(availableReleases, versionInput) if (version == null) { - throw `Could not find a Julia version that matches ${versionInput}` + throw new Error(`Could not find a Julia version that matches ${versionInput}`) } // GitHub tags start with v, remove it @@ -48,13 +48,13 @@ function getDownloadURL(version: string, arch: string): string { platform = 'winnt' } else if (osPlat === 'darwin') { // macOS if (arch == 'x86') { - throw '32-bit Julia is not available on macOS' + throw new Error('32-bit Julia is not available on macOS') } platform = 'mac' } else if (osPlat === 'linux') { // Linux platform = 'linux' } else { - throw `Platform ${osPlat} is not supported` + throw new Error(`Platform ${osPlat} is not supported`) } // nightlies @@ -78,7 +78,7 @@ function getFileName(version: string, arch: string): string { ext = 'exe' } else if (osPlat === 'darwin') { // macOS if (arch == 'x86') { - throw '32-bit Julia is not available on macOS' + throw new Error('32-bit Julia is not available on macOS') } versionExt = '-mac64' ext = 'dmg' @@ -90,7 +90,7 @@ function getFileName(version: string, arch: string): string { } ext = 'tar.gz' } else { - throw `Platform ${osPlat} is not supported` + throw new Error(`Platform ${osPlat} is not supported`) } return `julia-${version}${versionExt}.${ext}` @@ -124,6 +124,6 @@ export async function installJulia(version: string, arch: string): Promise