From bd1867a4f24d86504bc3a688150be961299dbd82 Mon Sep 17 00:00:00 2001 From: Diogo Soares <32431609+DiogoSoaress@users.noreply.github.com> Date: Wed, 11 Dec 2024 15:14:27 +0100 Subject: [PATCH 1/2] fix: return null in the catch block --- src/lib/fetchTotalSafesDeployed.ts | 5 ++++- src/lib/fetchTotalTransactions.ts | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib/fetchTotalSafesDeployed.ts b/src/lib/fetchTotalSafesDeployed.ts index e667c6ee..e8edefae 100644 --- a/src/lib/fetchTotalSafesDeployed.ts +++ b/src/lib/fetchTotalSafesDeployed.ts @@ -13,5 +13,8 @@ export const fetchTotalSafesDeployed = async (): Promise => { return res.json() }) .then((data) => data.result.rows[0].num_safes) - .catch((err) => console.error(`Error fetching total safes deployed: ${err.message}`)) + .catch((err) => { + console.error(`Error fetching total safes deployed: ${err.message}`) + return null + }) } diff --git a/src/lib/fetchTotalTransactions.ts b/src/lib/fetchTotalTransactions.ts index 0bc23883..b56986c3 100644 --- a/src/lib/fetchTotalTransactions.ts +++ b/src/lib/fetchTotalTransactions.ts @@ -13,5 +13,8 @@ export const fetchTotalTransactions = async (): Promise => { return res.json() }) .then((data) => data.result.rows[0].num_txs) - .catch((err) => console.error(`Error fetching total number of transactions: ${err.message}`)) + .catch((err) => { + console.log(`Error fetching total number of transactions: ${err.message}`) + return null + }) } From 5cf24499528db3ea26cc13d5a0d3c28d985d19f4 Mon Sep 17 00:00:00 2001 From: Diogo Soares <32431609+DiogoSoaress@users.noreply.github.com> Date: Wed, 11 Dec 2024 15:16:42 +0100 Subject: [PATCH 2/2] console.error --- src/lib/fetchTotalTransactions.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/fetchTotalTransactions.ts b/src/lib/fetchTotalTransactions.ts index b56986c3..c535fba7 100644 --- a/src/lib/fetchTotalTransactions.ts +++ b/src/lib/fetchTotalTransactions.ts @@ -14,7 +14,7 @@ export const fetchTotalTransactions = async (): Promise => { }) .then((data) => data.result.rows[0].num_txs) .catch((err) => { - console.log(`Error fetching total number of transactions: ${err.message}`) + console.error(`Error fetching total number of transactions: ${err.message}`) return null }) }