nedbat / scriv

Changelog management tool
https://scriv.readthedocs.io
Apache License 2.0
260 stars 29 forks source link

Error messages for invalid `version = literal: ...` in config #84

Closed rudyardrichter closed 1 year ago

rudyardrichter commented 1 year ago

It's a very minor issue but an invalid version config field causes error messages that (imo) could be more specific/informative. If it would be welcome, I would happily add a PR to have an error suggest the correct format.

Missing variable name

As an example this configuration

version = literal: myproj/__init__.py

produces this error:

ValueError: not enough values to unpack (expected 3, got 2)

File available, but missing variable name

For example this configuration:

version = literal: myproj/__init__.py:

leads to this error:

scriv.exceptions.ScrivException: Couldn't find literal: 'literal: src/template_python/__init__.py:'
nedbat commented 1 year ago

Good idea!

Now (as of commit bf5d9cf1924bb9096a5fc6b764f068ee9cc49c58) both of these errors will produce: ScrivException: Couldn't read 'version' configuration: Missing value name: 'literal: myproj/__init__.py'. I also added more detail to other kinds of failures reading literals.

nedbat commented 1 year ago

This is now released as part of scriv 1.2.1.