avoid generating uncaught exceptions in app #93

wants to merge 3 commits into


None yet

2 participants



I have put this code to avoid uncaught exceptions crashing app when no mongo connexion, in order application to be still running even when mongo is stopped.




I was just about to work on a similar pull request. Thanks for writing this!

The issue is both that connect-mongo generates unhandled exceptions and that anything which calls _get_collection will never call its callback if an error occurs, which can hang calling code waiting for a response.

One suggestion I'd make for the pull request (or for a separate related pull request) is to either include err.message in the message of the returned Error objects or add a property on them to get to the original error so that users can figure out why connect-mongo was unable to get the collection or ensure the TTL index.


Hi, thanks for feedback, I will check what I can do later ( after holidays now ;) ) but do not hesitate fork it.

@jdesboeufs jdesboeufs added a commit that closed this pull request Dec 21, 2014
@jdesboeufs Improve error management
Close #93
Fix #138, #89
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment