Skip to content

Commit

Permalink
fix: return null in the catch block (#523)
Browse files Browse the repository at this point in the history
* fix: return null in the catch block

* console.error
  • Loading branch information
DiogoSoaress authored Dec 11, 2024
1 parent f886e1e commit efc2a1d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/lib/fetchTotalSafesDeployed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@ export const fetchTotalSafesDeployed = async (): Promise<number | null> => {
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
})
}
5 changes: 4 additions & 1 deletion src/lib/fetchTotalTransactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,8 @@ export const fetchTotalTransactions = async (): Promise<number | null> => {
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.error(`Error fetching total number of transactions: ${err.message}`)
return null
})
}

0 comments on commit efc2a1d

Please sign in to comment.