diff --git a/validator/residue_index.py b/validator/residue_index.py index 0774810..55b343c 100644 --- a/validator/residue_index.py +++ b/validator/residue_index.py @@ -69,8 +69,15 @@ class ResidueIndexes(object): """ chain_id = chain_data["chain_label"] url = "%s%s/chain/%s" % (self.api_url, self.pdb_id, chain_id) - response = requests.get(url) - residue_numbering = json.loads(response.text) + try: + response = requests.get(url) + except: + return False + try: + residue_numbering = json.loads(response.text) + except: + print("Failed to load residues from PDBe API") + return False if not residue_numbering.keys(): self.mismatches.append("No residues in PDB for this entry - probably obsoleted entry") return False diff --git a/validator/validator.py b/validator/validator.py index 326e7e3..691eae7 100644 --- a/validator/validator.py +++ b/validator/validator.py @@ -87,8 +87,8 @@ class Validator(object): with open(path, "r") as json_file: try: return json.load(json_file) - except json.decoder.JSONDecodeError as err: - self.error_log = "JSON error: %s" % err + except: + self.error_log = "JSON error: %s" % path return None except IOError as ioerr: self.error_log = "File error: %s" % ioerr