Ah indeed. I see your point. It makes a lot of sense.

We'd like to be able to count the number of mongodb exceptions and their types, without having to massively change any client code (eg doctrine-odm). Some parts (but not all) of the application code catch all the exceptions thrown by doctrine and swallow them, in which case we wouldn't be able to count these exceptions. If we'd type all the exceptions (which is a great idea IMO), we could catch exceptions that would bubble up to the top in the exception_handler and count them. But that wouldn't cover exceptions caught by code and not thrown again (be it 3rd party libraries or application code).

By hooking directly into doctrine/mongodb, we don't need to change any of the client code.