From 84a2d2d22bc1f7002c22f2ecfab3fb8e25f39684 Mon Sep 17 00:00:00 2001 From: Avikalp Kumar Gupta Date: Mon, 8 Apr 2024 11:48:00 +0530 Subject: [PATCH] add catch block to insert repos query in setupRepos.ts --- utils/db/setupRepos.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/utils/db/setupRepos.ts b/utils/db/setupRepos.ts index 73e0b530..4d780c77 100644 --- a/utils/db/setupRepos.ts +++ b/utils/db/setupRepos.ts @@ -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}`);