Set errors if an error occurs.