Fixed the doctest failure as a result of my previous commit. Also updated the way exceptions are re-thrown.