Skip to content

Commit 4156dec

Browse files
fix(bulk-operations): use console-log policy for catch() error visibility
Post-merge, the console-log state moved from configHandler.get('log'). showConsoleLogs to the process-wide console-policy module, and the configHandler import was dropped. catch() still referenced configHandler, breaking the build (TS2304). Switch the guard to isConsoleLogEnabled() so the friendly error line still prints on failure when console logs are off, without double-printing when they are on. Matches the convention the rest of the file now follows. Ref: DX-10224 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent fb502ce commit 4156dec

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

packages/contentstack-bulk-operations/src/base-bulk-command.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
getChalk,
1212
loadChalk,
1313
CLIProgressManager,
14+
isConsoleLogEnabled,
1415
} from '@contentstack/cli-utilities';
1516

1617
import config from './config';
@@ -656,13 +657,12 @@ export abstract class BaseBulkCommand extends Command {
656657
// For other errors, use the CLI utilities error handler
657658
handleAndLogError(error);
658659

659-
// handleAndLogError only reaches the console when log.showConsoleLogs is enabled
660+
// handleAndLogError only reaches the console when the console-log policy is enabled
660661
// (the winston error transport is silenced otherwise), so a failure would leave the
661662
// terminal completely silent when the user has console logs turned off. Print a
662663
// user-facing error line here to fill that gap, guarded so we don't double-print when
663664
// console logs are on and handleAndLogError already emitted the error.
664-
const showConsoleLogs = Boolean(configHandler.get('log')?.showConsoleLogs);
665-
if (!showConsoleLogs) {
665+
if (!isConsoleLogEnabled()) {
666666
const errorMessage = cliErrorHandler.classifyError(error)?.message || error?.message || 'Unknown error';
667667
cliux.print(`Error: ${errorMessage}`, { color: 'red' });
668668
}

0 commit comments

Comments
 (0)