hyperswitch
hyperswitch copied to clipboard
refactor: Throw 500 error on database connection error instead of panic
Type of Change
- [x] Refactoring
Description
Do not panic while getting db connection. Instead of that just throw 500 error. This PR also makes connection timeout in Database configurable.
Additional Changes
- [x] This PR modifies application configuration/environment variables
Motivation and Context
When database goes down we don't want our application panic and stop actix workers since restarting it has much overhead. So instead just 500 error.
How did you test it?
Start the application and bring down the database and try to make a payment. Throws 500 error.
Checklist
- [x] I formatted the code
cargo +nightly fmt --all
- [x] I addressed lints thrown by
cargo clippy
- [x] I reviewed submitted code