File tree Expand file tree Collapse file tree
packages/contentstack-bulk-operations/src Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5,10 +5,13 @@ import {
55 createLogContext ,
66 getLogPath ,
77 handleAndLogError ,
8+ cliErrorHandler ,
9+ cliux ,
810 FlagInput ,
911 getChalk ,
1012 loadChalk ,
1113 CLIProgressManager ,
14+ isConsoleLogEnabled ,
1215} from '@contentstack/cli-utilities' ;
1316
1417import config from './config' ;
@@ -651,13 +654,18 @@ export abstract class BaseBulkCommand extends Command {
651654 * This includes errors during init, run, and other phases
652655 */
653656 async catch ( error : Error ) : Promise < void > {
654- // Check if this is a DisplayedError (should be shown to user)
655- // if (error.name === 'DisplayedError') {
656- // process.exit(1);
657- // }
658-
659657 // For other errors, use the CLI utilities error handler
660658 handleAndLogError ( error ) ;
659+
660+ // handleAndLogError only reaches the console when the console-log policy is enabled
661+ // (the winston error transport is silenced otherwise), so a failure would leave the
662+ // terminal completely silent when the user has console logs turned off. Print a
663+ // user-facing error line here to fill that gap, guarded so we don't double-print when
664+ // console logs are on and handleAndLogError already emitted the error.
665+ if ( ! isConsoleLogEnabled ( ) ) {
666+ const errorMessage = cliErrorHandler . classifyError ( error ) ?. message || error ?. message || 'Unknown error' ;
667+ cliux . print ( `Error: ${ errorMessage } ` , { color : 'red' } ) ;
668+ }
661669 }
662670
663671 abstract run ( ) : Promise < void > ;
You can’t perform that action at this time.
0 commit comments