Skip to content

Commit

Permalink
Improve error message on schema validation (#220)
Browse files Browse the repository at this point in the history
* better error message

* style: [pre-commit.ci] auto fixes [...]

* Update npe2/manifest/schema.py

Co-authored-by: Talley Lambert <talley.lambert@gmail.com>

* fix precommit

* no cover

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Talley Lambert <talley.lambert@gmail.com>
  • Loading branch information
3 people authored Aug 3, 2022
1 parent 3fc6e6d commit 56ebc45
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion npe2/manifest/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,11 @@ def _from_entrypoint(
meta = PackageMetadata.from_dist_metadata(distribution.metadata)
mf.package_metadata = meta

assert mf.name == meta.name, "Manifest name must match package name"
if mf.name != meta.name:
raise ValueError( # pragma: no cover
f"The name field in the manifest ({mf.name!r}) "
f"must match the package name ({meta.name!r})"
)
return mf

raise FileNotFoundError( # pragma: no cover
Expand Down

0 comments on commit 56ebc45

Please sign in to comment.