-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
ISSUE_NUMBER: GH-1
Description
The ConnectToDB function in src/db/db.ts only logs the error to the console when the database connection fails. This is not sufficient for a production environment.
File: repositories/leadllyadminapi/src/db/db.ts
Line: 11-13
Severity: high
Current Behavior
The application logs the error and continues to run, potentially leading to unexpected behavior.
Expected Behavior
The application should gracefully handle the error, potentially retry the connection, or alert administrators.
Suggested Fix
Add more robust error handling, such as retrying the connection or exiting the application.
Code Context
try {
await mongoose.connect(DatabaseUrl);
db = mongoose.connection;
console.log("LEADLLY_DB_URL Connected.");
} catch (error) {
console.log(error);
}Additional Notes
This affects the reliability of the application and could lead to data loss or corruption.