From 09073ea760cf8cb14fe01067c257d1d31c8f692b Mon Sep 17 00:00:00 2001 From: Anthony Johnson Date: Tue, 8 Feb 2022 11:07:17 -0800 Subject: [PATCH] Reduce verbose logging on generic command failure We updated the copy used for generic errors with the celery refactor, but also converted a generic command failure to `BuildUserError(msg)`. This caused the command output to always be used as the error message shown to the user. More error classes is probably the direction we want to go here, perhaps even going as far as to provide more helpful errors for each step that commonly emits the generic user error class. --- readthedocs/doc_builder/environments.py | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/readthedocs/doc_builder/environments.py b/readthedocs/doc_builder/environments.py index 7e3c0ac7f2b..1d3c1e82316 100644 --- a/readthedocs/doc_builder/environments.py +++ b/readthedocs/doc_builder/environments.py @@ -444,24 +444,21 @@ def run_command_class( self.commands.append(build_cmd) if build_cmd.failed: - msg = 'Command {cmd} failed'.format(cmd=build_cmd.get_command()) - - # TODO: improve this error report. This is showing _the full_ - # stdout to the user exposing it at the top of the Build Detail's - # page in red. It would be good to reduce the noise here and just - # point the user to take a look at its output from the command's - # output itself. - if build_cmd.output: - msg += ':\n{out}'.format(out=build_cmd.output) - if warn_only: + msg = 'Command {cmd} failed'.format(cmd=build_cmd.get_command()) + if build_cmd.output: + msg += ':\n{out}'.format(out=build_cmd.output) log.warning( msg, project_slug=self.project.slug if self.project else '', version_slug=self.version.slug if self.version else '', ) else: - raise BuildUserError(msg) + # TODO: for now, this still outputs a generic error message + # that is the same across all commands. We could improve this + # with more granular error messages that vary by the command + # being run. + raise BuildUserError() return build_cmd