You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
PubGrubError currently has a PubGrubError::Failure(String) variant with two usages: "a package was chosen but we don't have a term." and "choose_package_version picked an incompatible version". Both of these only occur when breaking the dependency provider contract. We should either replace them by panics, or replace the String with two dedicated variants.
The text was updated successfully, but these errors were encountered:
choose_package_version is also an old name based on the v0.2 API.
I don’t have strong opinions on this. I think having a failure type instead of panics can provide better error messages since it can be unwind at the most adequate level to provide useful information as to why and in which context that error occurred.
Looking more closely at both examples, they should clearly be panics. For the first one it's not even clear how this could be a user's fault, something in the algorithm has gone very wrong if we end up in the situation. For the second one, the user has clearly messed up, but it's not hard to provide all of the context namely what package was requested with what VS and what V was returned.
On the other hand, this provided us a way to add new errors without making a breaking change. If that something we care about we should mark this enum as "nonexhaustive".
As a user, i'd like to handle pubgrub errors exhaustively and if required match on or add context to DependencyProvider::Err, so i'd new variants to be breaking changes.
On a related note, in uv we removed PubGrubError::SelfDependency since in python sometimes packages depend on themselves since pip allows it, it's just a no-op.
PubGrubError
currently has aPubGrubError::Failure(String)
variant with two usages: "a package was chosen but we don't have a term." and "choose_package_version picked an incompatible version". Both of these only occur when breaking the dependency provider contract. We should either replace them by panics, or replace theString
with two dedicated variants.The text was updated successfully, but these errors were encountered: