vadimtsushko/mongo_dart — pull request #50 by luizmineo (2014-05-26 16:47:25+00:00)
Title: Add socket error handling

Hi,

This is a simple patch to allow better error handling when a connection with the database is lost.

In the current version, if a connection is lost and the user sends a query to the database, a error is thrown in the zone where the connection was open, not in the zone where the user sent the query, which makes the process of handling error more difficult, especially when you need to reuse connections.

With this patch, if the connection is lost, the driver will notify any pending request associated with the connection. If another request is received, it will answer the request with an error, instead of trying to write the message to the socket.