Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Differenctiate ValueErrors #143

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Differenctiate ValueErrors #143

wants to merge 2 commits into from

Conversation

Carreau
Copy link
Contributor

@Carreau Carreau commented Oct 18, 2024

ValueErrors are a bit too generic, and by raising/catching them we loose a potential useful information; For example an invalid content type for the index, is dealt as the same way than a missing wheel.

This introduces new exceptions for various cases, ant stop catching the now UnsupportedContentTypeError, as I believe it should be a hard error as we are likely having either an error with the index software, or a user configuraition error.

See also beginning of discussion in #142

--

Opening as draft, I'm expecting the tests to fails

ValueErrors are a bit too generic, and by raising/catching them we loose
a potential useful information; For example an invalid content type for
the index, is dealt as the same way than a missing wheel.

This introduces new exceptions for various cases, ant stop catching the
now UnsupportedContentTypeError, as I believe it should be a hard error as
we are likely having either an error with the index software, or a user
configuraition error.

See also beginning of discussion in pyodide#142
@Carreau
Copy link
Contributor Author

Carreau commented Oct 18, 2024

Note, I also try to have all new exceptions in the form of XxxxError.

)


class NoValidIndexForPackageError(Exception):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe PackageNotFoundError would be better? NoValidIndex is a bit confusing IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would be a synonym of PackageNotFoundError from importlib.metadata which is used un the same file... I've used a slightly longer name to differentiate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants