Skip to content

Commit

Permalink
add catch block to insert repos query in setupRepos.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
avikalpg committed Apr 8, 2024
1 parent 00c4ddb commit 84a2d2d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion utils/db/setupRepos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ export const saveSetupReposInDb = async (args: SetupReposArgs, userId: string):
`;
try {
await conn.query('BEGIN');
const { rowCount: reposRowCount, rows } = await conn.query(insertReposQuery, [repo_owner, repo_provider, repo_names, install_id]);
const { rowCount: reposRowCount, rows } = await conn.query(insertReposQuery, [repo_owner, repo_provider, repo_names, install_id])
.catch(err => {
console.error(`[saveSetupReposInDb] Could not insert repos for user (${userId}) in the ${args.repo_owner} workspace on ${args.repo_provider}`, { pg_query: insertReposQuery }, err);
throw err;
});
if (reposRowCount === 0) {
await conn.query('ROLLBACK');
console.error(`[saveSetupRepos] No repositories were inserted or updated for: ${install_id}, ${repo_names}`);
Expand Down

0 comments on commit 84a2d2d

Please sign in to comment.