Skip to content

Commit

Permalink
Merge pull request #232 from dianakolusheva/fix_xdd
Browse files Browse the repository at this point in the history
Catch xdd connection error
  • Loading branch information
bgyori committed Jun 21, 2021
2 parents 7bd2fc3 + 9c864da commit 07d5698
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion emmaa/xdd/xdd_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,12 @@ def get_figures_from_query(query, limit=None):

def send_request(url, params):
"""Send a request and handle potential errors."""
res = requests.get(url, params=params)
try:
res = requests.get(url, params=params)
# Catch connection error
except Exception as e:
logger.info(e)
return
try:
rj = res.json()
if 'objects' not in rj:
Expand All @@ -136,6 +141,7 @@ def send_request(url, params):
if 'error' in rj:
logger.warning(rj['error'])
return
# Catch bad response
except Exception as e:
logger.info(e)
return
Expand Down

0 comments on commit 07d5698

Please sign in to comment.