Skip to content

Commit

Permalink
fix: better error handling when parsing package versions (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneskoester authored Jan 30, 2023
1 parent 0803d3d commit d20ff11
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion snakedeploy/conda.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,12 @@ def get_pkg_versions(conda_env_path):

def downgraded():
for pkg_name, version in posterior_pkg_versions.items():
version = packaging_version.parse(version)
try:
version = packaging_version.parse(version)
except packaging_version.InvalidVersion as e:
raise UserError(
f"Cannot parse version {version} of package {pkg_name}: {e}"
)
prior_version = prior_pkg_versions.get(pkg_name)
if prior_version is not None and version < packaging_version.parse(
prior_version
Expand Down Expand Up @@ -297,6 +302,9 @@ def add_file(self, filepath, content, is_updated, msg):

@retry(tries=2, delay=60)
def create(self):
import pdb

pdb.set_trace()
if not self.files:
logger.info("No files to commit.")
return
Expand Down

0 comments on commit d20ff11

Please sign in to comment.