From 361639fb97ce68b36cf9b4f134712bd3fa07dbce Mon Sep 17 00:00:00 2001 From: Munyoki Kilyungi Date: Mon, 28 Nov 2022 17:12:09 +0300 Subject: Catch a URLError when virtuoso isn't running at all * gn3/api/metadata.py: Import URLError. (jsonify_dataset_metadata): Add URLError in except block. --- gn3/api/metadata.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gn3') diff --git a/gn3/api/metadata.py b/gn3/api/metadata.py index 156af97..35e4067 100644 --- a/gn3/api/metadata.py +++ b/gn3/api/metadata.py @@ -1,5 +1,6 @@ """API for fetching metadata using an API""" from http.client import RemoteDisconnected +from urllib.error import URLError from flask import Blueprint from flask import jsonify from flask import current_app @@ -23,5 +24,5 @@ def jsonify_dataset_metadata(accession_id): ).data ) # The virtuoso server is misconfigured or it isn't running at all - except RemoteDisconnected: + except (RemoteDisconnected, URLError): return jsonify({}) -- cgit v1.2.3