11
2- import { getBranchFromAlias , log , formatError , handleAndLogError } from '@contentstack/cli-utilities' ;
2+ import { getBranchFromAlias , log , handleAndLogError } from '@contentstack/cli-utilities' ;
33import { QueryExportConfig } from '../types' ;
4- import { createLogContext } from './logger' ;
54
65/**
76 * Validates and sets up branch configuration for the stack
@@ -15,7 +14,7 @@ export const setupBranches = async (config: QueryExportConfig, stackAPIClient: a
1514 throw new Error ( 'The branch configuration is invalid.' ) ;
1615 }
1716
18- const context = createLogContext ( config ) ;
17+ const context = config . context ;
1918
2019 try {
2120 if ( config . branchAlias ) {
@@ -30,7 +29,7 @@ export const setupBranches = async (config: QueryExportConfig, stackAPIClient: a
3029 . branch ( config . branchName )
3130 . fetch ( )
3231 . catch ( ( err : unknown ) : any => {
33- log . error ( ` Error fetching branch: ${ formatError ( err ) } ` , context ) ;
32+ handleAndLogError ( err , context , ' Error fetching branch' ) ;
3433 return null ;
3534 } ) ;
3635
@@ -63,7 +62,7 @@ export const setupBranches = async (config: QueryExportConfig, stackAPIClient: a
6362 }
6463 config . branchEnabled = true ;
6564 } catch ( error ) {
66- handleAndLogError ( error , context as any , 'Error setting up branches' ) ;
65+ handleAndLogError ( error , context , 'Error setting up branches' ) ;
6766 throw error ;
6867 }
6968} ;
0 commit comments