Skip to content

Commit

Permalink
improve the formatting of resolution errors
Browse files Browse the repository at this point in the history
Use ValueError exceptions to provide a nicer
message for the resolver when it fails.
  • Loading branch information
dhellmann committed Nov 1, 2024
1 parent 9d3e4b9 commit 14c4f91
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/fromager/resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ def resolve_from_provider(
) -> tuple[str, Version]:
reporter: resolvelib.BaseReporter = resolvelib.BaseReporter()
rslvr: resolvelib.Resolver = resolvelib.Resolver(provider, reporter)
result = rslvr.resolve([req])
try:
result = rslvr.resolve([req])
except resolvelib.resolvers.exceptions.ResolutionImpossible as err:
raise ValueError(f"Unable to resolve {req}") from err
# resolvelib actually just returns one candidate per requirement.
# result.mapping is map from an identifier to its resolved candidate
candidate: Candidate
Expand Down

0 comments on commit 14c4f91

Please sign in to comment.