Exits properly using the set error.