Skip to content

Conversation

@abravalheri
Copy link
Contributor

@abravalheri abravalheri commented Sep 5, 2024

It seems that there was an easy oversight when implementing the error message for invalid dynamic fields.

Right now, it shows the name of all fields that are listed (including the valid ones), instead of showing only the name of the invalid field.

For example, exception looks like the following:

packaging.metadata.InvalidMetadata: ['author', 'author-email', 'classifier', 'description', 'description-content-type', 'download-url', 'home-page', 'keywords', 'license', 'license-file', 'maintainer', 'maintainer-email', 'obsoletes', 'platform', 'project-url', 'provides', 'provides-extra', 'requires', 'requires-dist', 'requires-python', 'summary'] is not a valid dynamic field

... which is not very great, because it lets to the user the work of figuring out which one of these fields is invalid..

A better error message (which I believe to be the original intent) would be:

packaging.metadata.InvalidMetadata: 'license-file' is not a valid dynamic field

@abravalheri abravalheri force-pushed the fix-uninformative-error-message branch from c0ee2d6 to 92bf3f6 Compare September 5, 2024 16:10
@pradyunsg pradyunsg enabled auto-merge (squash) September 5, 2024 18:57
@pradyunsg pradyunsg merged commit a716c52 into pypa:main Sep 5, 2024
@abravalheri abravalheri deleted the fix-uninformative-error-message branch September 5, 2024 19:03
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.

2 participants