Skip to content

Conversation

@Hussain-Tinwala
Copy link

This PR addresses Issue #118 by implementing robust connection validation and enhanced error handling for MongoDB.

This is a critical bug fix that stabilizes database initialization and provides clear, actionable feedback to the user on connection failure.

Key Changes Implemented

  • URI Validation: Added regex validation to confirm the connection string uses the required mongodb:// or mongodb+srv:// protocols, catching invalid formats early.
  • Enhanced Error Handling: Implemented specific try...except blocks within _create_database_manager to catch pymongo.errors.ConnectionFailure and ConfigurationError.
  • User Feedback: The application now raises a clear, user-friendly MemoriError when the connection fails, instructing the user to check their URI or service status.

This is the contribution for Hacktoberfest 2025!

@Hussain-Tinwala
Copy link
Author

Hii @Boburmirzo, I have submitted the PR,
Please review review it and let me know if any further changes are required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant