log the errors before a throw.