better logging of errors

@darbyfrey