Handle exceptions more consistently.