Skip to content

Commit

Permalink
fix: fix try catch on git command
Browse files Browse the repository at this point in the history
  • Loading branch information
Romakita committed Oct 24, 2024
1 parent 6f3a785 commit 01bef47
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/monorepo/src/utils/workspace/syncRepository.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import {git} from "../cli/index.js";

function asyncCatchError(fn, context) {
return async (...args) => {
try {
return await fn(...args);
} catch (er) {
context.logger.error(String(er), er.stack);
}
};
async function asyncCatchError(fn, context) {
try {
return await fn();
} catch (er) {
context.logger.error(String(er), er.stack);
}
}

/**
Expand All @@ -17,6 +15,8 @@ function asyncCatchError(fn, context) {
export async function syncRepository(context) {
const {logger, productionBranch, developBranch, branchName, origin} = context;

await asyncCatchError(() => git.fetch());

logger.info(`Push ${productionBranch}`);
logger.info(`git push --quiet --set-upstream ${origin} ${productionBranch}`);

Expand Down

0 comments on commit 01bef47

Please sign in to comment.