dnf-json: fix depsolve error handling

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.
This commit is contained in:
Achilleas Koutsou 2022-06-27 18:12:53 +02:00 committed by Christian Kellner
parent be2195b235
commit d59d870574

View file

@ -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, {