Skip to content

Commit 00c3b7b

Browse files
committed
python should not raise errors
1 parent 5a4050c commit 00c3b7b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

compute_next_version.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@ def main(
1818
commit_log: str,
1919
ignore_patterns: list[str],
2020
force_patch: bool,
21-
):
21+
) -> None:
2222
"""Print the next version of a package; if there's no print, then's no new version."""
2323

2424
# is a release needed?
2525
if not changed_files:
26-
raise ValueError("No changes detected")
26+
return print("No changes detected", file=sys.stderr)
2727
if all(any(fnmatch(f, pat) for pat in ignore_patterns) for f in changed_files):
28-
raise ValueError("None of the changed files require a release.")
28+
return print("None of the changed files require a release.", file=sys.stderr)
2929

3030
# detect bump
3131
if "[major]" in commit_log:
@@ -37,7 +37,7 @@ def main(
3737
elif force_patch:
3838
bump = BumpType.PATCH
3939
else:
40-
return sys.exit(0) # no release needed!
40+
return print("Commit log doesn't signify a version bump.", file=sys.stderr)
4141

4242
# increment
4343
major, minor, patch = map(int, tag.split("."))
@@ -51,7 +51,7 @@ def main(
5151
case BumpType.PATCH:
5252
patch += 1
5353
case _:
54-
raise ValueError(f"Bump type not supported: {bump}")
54+
return print(f"Bump type not supported: {bump}", file=sys.stderr)
5555

5656
# print the next version
5757
print(f"{major}.{minor}.{patch}")

0 commit comments

Comments
 (0)