DRYing up error handling.