Open vinayak0035 opened 3 weeks ago
Hey @vinayak0035 thanks for flagging this! Could you maybe open a PR for this ?
@Raneet10 PR: https://github.com/maticnetwork/heimdall/pull/1198
@Raneet10 @pratikspatil024 New PR: https://github.com/maticnetwork/heimdall/pull/1201
Summary
Implement error handling in the
GetBridgeDBInstance
function to handle cases where thebridgeDB
object is nil.Problem Definition
Currently, the
GetBridgeDBInstance
function does not handle scenarios wherebridgeDB
may be nil. If the database fails to open for any reason, returning a nil object can lead to potential runtime panics or errors when the returned database instance is used. Adding error handling will help prevent these issues and improve the robustness of the code.Benefits of including this feature include:
Proposal
Modify the
GetBridgeDBInstance
function to include error handling. The implementation could look like this:https://github.com/maticnetwork/heimdall/blob/master/bridge/setu/util/db.go#L16
This change ensures that the function returns an error if the database fails to open, allowing the caller to handle it appropriately.
For Admin Use