Skip to content

Commit

Permalink
dnf-json: fix depsolve error handling
Browse files Browse the repository at this point in the history
When a DepsolveError exception occurs, the error message would print the
packages in the request.  When the request arguments changed, the error
message handling wasn't updated and would fail to produce the correct
error message.

Compile a list of packages from all transactions and print them in the
error message as a comma-separated list.
  • Loading branch information
achilleas-k authored and gicmo committed Jun 27, 2022
1 parent be2195b commit d59d870
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dnf-json
Expand Up @@ -212,9 +212,13 @@ def solve(request, cache_dir):
}
except dnf.exceptions.DepsolveError as e:
printe("error depsolve")
# collect list of packages for error
pkgs = []
for t in transactions:
pkgs.extend(t["package-specs"])
return None, {
"kind": "DepsolveError",
"reason": f"There was a problem depsolving {arguments['package-specs']}: {e}"
"reason": f"There was a problem depsolving {', '.join(pkgs)}: {e}"
}
except dnf.exceptions.RepoError as e:
return None, {
Expand Down

0 comments on commit d59d870

Please sign in to comment.