Skip to content

Commit

Permalink
catch parse error -> question if it's a valid LCA DB
Browse files Browse the repository at this point in the history
  • Loading branch information
ctb committed Feb 19, 2018
1 parent 774856f commit aae3c49
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sourmash_lib/lca/lca_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ def load(self, db_name):
xopen = gzip.open

with xopen(db_name, 'rt') as fp:
load_d = json.load(fp)
try:
load_d = json.load(fp)
except json.decoder.JSONDecodeError:
raise ValueError("cannot parse database file '{}'; is it a valid LCA db?".format(db_name))
version = load_d['version']
assert version == '1.0'

Expand Down

0 comments on commit aae3c49

Please sign in to comment.