Skip to content

Commit

Permalink
Fix error reporting on tasks
Browse files Browse the repository at this point in the history
If a task fails not due to an Exception, we do not get the description field.
Try reason filed instead.

fixes #464
  • Loading branch information
mdellweg authored and ggainey committed Feb 2, 2022
1 parent 1102389 commit a970a86
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES/464.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed a bug in reporting the failure of a task if the reason was not an exception in the task code.
3 changes: 2 additions & 1 deletion pulpcore/cli/common/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@ def _check_task_finished(task: EntityDefinition) -> bool:
elif task["state"] == "failed":
raise click.ClickException(
_("Task {task_href} failed: '{description}'").format(
task_href=task_href, description=task["error"]["description"]
task_href=task_href,
description=task["error"].get("description") or task["error"].get("reason"),
)
)
elif task["state"] == "canceled":
Expand Down

0 comments on commit a970a86

Please sign in to comment.