ajdavis/mongo-python-driver — pull request #2 by FlorianLudwig (2012-09-29 20:27:18+00:00)
Title: Motor

When an error occours during open_sync() the error is rethrown like this:

Traceback (most recent call last):
File "test.py", line 27, in
connection = motor.MotorConnection().open_sync()
File "mongo-python-driver/motor/__init__.py", line 682, in open_sync
raise outcome['error']
ZeroDivisionError: integer division or modulo by zero

The traceback does not contain any information about the actual call stack at the time of the exception. This patch changes the error handling to save the full traceback object and not just the exception and then print the traceback resulting in an error message like this:

File "motor/__init__.py", line 612, in _connect
self.delegate = self.__delegate_class__(*args, **kwargs)
File "mongo-python-driver/pymongo/connection.py", line 203, in __init__
1/0
ZeroDivisionError: integer division or modulo by zero