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> {
5555 await writeFile ( cachePath , JSON . stringify ( results , replace ) ) ;
5656 console . log ( join ( values . root , cachePath ) ) ;
5757 } catch ( error ) {
58- console . error ( String ( error ) ) ;
58+ console . error ( getErrorMessage ( error ) ) ;
5959 process . exit ( 1 ) ;
6060 }
6161}
@@ -65,3 +65,12 @@ export default async function run(args?: string[]): Promise<void> {
6565function replace ( this : { [ key : string ] : unknown } , key : string , value : unknown ) : unknown {
6666 return this [ key ] instanceof Date ? Date . prototype . toJSON . call ( this [ key ] ) : value ;
6767}
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