File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -389,7 +389,7 @@ const translate = async (
389
389
ncp (
390
390
evaluateFilePath ( workingDir , dirStructure , sourceLang ) ,
391
391
evaluateFilePath ( resolvedCacheDir , dirStructure , sourceLang ) ,
392
- ( err ) => ( err ? rej ( ) : res ( null ) ) ,
392
+ ( err ) => ( err ? rej ( err ) : res ( null ) ) ,
393
393
) ,
394
394
) ;
395
395
console . log ( chalk `└── {green.bold Translation files have been cached.}` ) ;
@@ -441,11 +441,17 @@ translate(
441
441
commander . appName ,
442
442
commander . context ,
443
443
commander . overwrite ,
444
- ) . catch ( ( e : Error ) => {
444
+ ) . catch ( ( e : unknown ) => {
445
445
console . log ( ) ;
446
446
console . log ( chalk . bgRed ( 'An error has occurred:' ) ) ;
447
- console . log ( chalk . bgRed ( e . message ) ) ;
448
- console . log ( chalk . bgRed ( e . stack ) ) ;
447
+ if ( e instanceof Error ) {
448
+ console . log ( chalk . bgRed ( e . message ) ) ;
449
+ if ( e . stack ) {
450
+ console . log ( chalk . bgRed ( e . stack ) ) ;
451
+ }
452
+ } else {
453
+ console . log ( chalk . bgRed ( String ( e ) ) ) ;
454
+ }
449
455
console . log ( ) ;
450
456
process . exit ( 1 ) ;
451
457
} ) ;
You can’t perform that action at this time.
0 commit comments