diff --git a/sourmash_lib/lca/lca_utils.py b/sourmash_lib/lca/lca_utils.py index fcdca0dc27..ffe8a8e93c 100644 --- a/sourmash_lib/lca/lca_utils.py +++ b/sourmash_lib/lca/lca_utils.py @@ -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'