Capture exceptions in doctests as well