Skip to content

Commit

Permalink
Improve error wording
Browse files Browse the repository at this point in the history
Co-authored-by: Ezio Melotti <[email protected]>
  • Loading branch information
hugovk and ezio-melotti authored Nov 10, 2024
1 parent ac5a101 commit 60f10af
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/blurb/blurb.py
Original file line number Diff line number Diff line change
Expand Up @@ -486,10 +486,10 @@ def finish_entry():
try:
int(value)
except (TypeError, ValueError):
throw(f"Invalid {issue_keys[key]} issue number! ({value!r})")
throw(f"Invalid {issue_keys[key]} number: {value!r}")

if key == "gh-issue" and int(value) < lowest_possible_gh_issue_number:
throw(f"The gh-issue number must be {lowest_possible_gh_issue_number} or above, not a PR number.")
throw(f"Invalid gh-issue number: {value!r} (must be >= {lowest_possible_gh_issue_number})")

if key == "section":
if no_changes:
Expand Down
6 changes: 3 additions & 3 deletions tests/test_blurb.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,15 +217,15 @@ def test_parse():
),
(
".. gh-issue: 1\n.. section: IDLE\nHello world!",
r"The gh-issue number must be 32426 or above, not a PR number",
r"Invalid gh-issue number: '1' \(must be >= 32426\)",
),
(
".. bpo: one-two\n.. section: IDLE\nHello world!",
r"Invalid bpo issue number! \('one-two'\)",
r"Invalid bpo number: 'one-two'",
),
(
".. gh-issue: one-two\n.. section: IDLE\nHello world!",
r"Invalid GitHub issue number! \('one-two'\)",
r"Invalid GitHub number: 'one-two'",
),
(
".. gh-issue: 123456\n.. section: Funky Kong\nHello world!",
Expand Down

0 comments on commit 60f10af

Please sign in to comment.