File tree Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Expand file tree Collapse file tree 2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,12 @@ import * as exec from "@actions/exec";
66import * as core from "@actions/core" ;
77import fs from "fs" ;
88
9+ const isENOENT = ( e : unknown ) : boolean => {
10+ return (
11+ typeof e === "object" && e !== null && "code" in e && e . code === "ENOENT"
12+ ) ;
13+ } ;
14+
915export class WindowsChannelInstaller implements Installer {
1016 constructor ( private readonly platform : Platform ) { }
1117
@@ -18,7 +24,7 @@ export class WindowsChannelInstaller implements Installer {
1824 try {
1925 await fs . promises . stat ( root ) ;
2026 } catch ( e ) {
21- if ( e . code === "ENOENT" ) {
27+ if ( isENOENT ( e ) ) {
2228 return undefined ;
2329 }
2430 throw e ;
Original file line number Diff line number Diff line change @@ -5,6 +5,10 @@ import * as installer from "./installer";
55import { getPlatform , OS } from "./platform" ;
66import path from "path" ;
77
8+ const hasErrorMessage = ( e : unknown ) : e is { message : string | Error } => {
9+ return typeof e === "object" && e !== null && "message" in e ;
10+ } ;
11+
812async function run ( ) : Promise < void > {
913 try {
1014 const version = core . getInput ( "chrome-version" ) || "latest" ;
@@ -26,7 +30,11 @@ async function run(): Promise<void> {
2630 await exec . exec ( binName , [ "--version" ] ) ;
2731 }
2832 } catch ( error ) {
29- core . setFailed ( error . message ) ;
33+ if ( hasErrorMessage ( error ) ) {
34+ core . setFailed ( error . message ) ;
35+ } else {
36+ console . error ( error )
37+ }
3038 }
3139}
3240
You can’t perform that action at this time.
0 commit comments