Skip to content

Commit

Permalink
ensure exit code 1 on invalid version
Browse files Browse the repository at this point in the history
  • Loading branch information
stinodego authored Feb 8, 2022
1 parent 767db61 commit 7dcb4ce
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions install-poetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,10 @@ def run(self) -> int:
elif self._path:
version = self._path
else:
version, current_version = self.get_version()
try:
version, current_version = self.get_version()
except ValueError:
return 1

if version is None:
return 0
Expand Down Expand Up @@ -756,11 +759,10 @@ def _compare_versions(x, y):
)

if self._version and self._version not in releases:
self._write(
colorize("error", "Version {} does not exist.".format(self._version))
)
msg = "Version {} does not exist.".format(self._version)
self._write(colorize("error", msg))

return None, None
raise ValueError(msg)

version = self._version
if not version:
Expand Down

0 comments on commit 7dcb4ce

Please sign in to comment.