From 4770d61671114c314311e4f79dc9b87694fd5941 Mon Sep 17 00:00:00 2001 From: Artem Sheremet Date: Sun, 16 Oct 2022 20:22:24 +0200 Subject: [PATCH] Fix new typescript findings --- src/main.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/main.ts b/src/main.ts index c08f015..cda57c8 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,7 +1,7 @@ import * as core from '@actions/core' -import {boolean} from 'boolean' +import { boolean } from 'boolean' import * as semver from 'semver' -import {deviceToString, getDevices, simctl} from './xcrun' +import { deviceToString, getDevices, simctl } from './xcrun' async function run(): Promise { try { @@ -86,7 +86,11 @@ async function run(): Promise { core.setOutput('udid', device.udid) } catch (error) { - core.setFailed(error.message) + let errorMessage = 'Failed to run simulator-action (reason unknown)'; + if (error instanceof Error) { + errorMessage = error.message; + } + core.setFailed(errorMessage); } } @@ -98,7 +102,11 @@ async function cleanup(): Promise { await simctl('shutdown', udid) } } catch (error) { - core.setFailed(error.message) + let errorMessage = 'Failed to cleanup simulator-action (reason unknown)'; + if (error instanceof Error) { + errorMessage = error.message; + } + core.setFailed(errorMessage); } }