Handle exceptions better

This commit is contained in:
Don Brown
2014-03-01 14:31:27 -07:00
parent 9125037c9b
commit 5626414f2d

View File

@@ -66,13 +66,13 @@ class MongoProtocol(asyncio.Protocol):
self.transport = None self.transport = None
# Raise exception on all waiting futures. # Raise exception on all waiting futures.
for f in self.__queries: for f in self.__queries.values():
f.set_exception(ConnectionLostError(exc)) f.set_exception(ConnectionLostError(exc))
logger.log(logging.INFO, 'Mongo connection lost') logger.log(logging.INFO, 'Mongo connection lost')
if self.__connection_lost_callback: if self.__connection_lost_callback:
self.__connection_lost_callback(exec) self.__connection_lost_callback(exc)
@property @property
def is_connected(self): def is_connected(self):