File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ export default async function run(args?: string[]): Promise<void> {
55
55
await writeFile ( cachePath , JSON . stringify ( results , replace ) ) ;
56
56
console . log ( join ( values . root , cachePath ) ) ;
57
57
} catch ( error ) {
58
- console . error ( String ( error ) ) ;
58
+ console . error ( getErrorMessage ( error ) ) ;
59
59
process . exit ( 1 ) ;
60
60
}
61
61
}
@@ -65,3 +65,12 @@ export default async function run(args?: string[]): Promise<void> {
65
65
function replace ( this : { [ key : string ] : unknown } , key : string , value : unknown ) : unknown {
66
66
return this [ key ] instanceof Date ? Date . prototype . toJSON . call ( this [ key ] ) : value ;
67
67
}
68
+
69
+ function getErrorMessage ( error : unknown ) : string {
70
+ return error instanceof Error &&
71
+ "errors" in error && // AggregateError
72
+ Array . isArray ( error . errors ) &&
73
+ error . errors . length > 0
74
+ ? String ( error . errors [ 0 ] )
75
+ : String ( error ) ;
76
+ }
You can’t perform that action at this time.
0 commit comments