peterbe/hashin

Poor error message for NoVersionsError

peterbe opened this issue · 0 comments

E.g.

▶ hashin black
Traceback (most recent call last):
  File "/usr/local/bin/hashin", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/hashin.py", line 499, in main
    include_prereleases=args.include_prereleases,
  File "/usr/local/lib/python3.6/site-packages/hashin.py", line 129, in run
    run_single_package(spec, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/hashin.py", line 157, in run_single_package
    include_prereleases=include_prereleases,
  File "/usr/local/lib/python3.6/site-packages/hashin.py", line 431, in get_package_hashes
    version = get_latest_version(data, include_prereleases)
  File "/usr/local/lib/python3.6/site-packages/hashin.py", line 243, in get_latest_version
    raise NoVersionsError(msg)
hashin.NoVersionsError: Not a single valid version found. But, found {0} pre-releases. Consider running again with the --include-prereleases flag.

The "Not a single valid version found" sounds vague and could be interpreted as "Not a single (as opposed to multiple) valid version found".

Also, the {0} was meant to fill in the number of prereleases found but it was never put into use.