Handle exceptions.