Clean up exception handling to the new format