Commit 89e18371 authored by Derek Homeier's avatar Derek Homeier
Browse files

Raise HTTPError as URLError

parent 1b23bc9c
Pipeline #2440 failed with stage
in 3 minutes and 44 seconds
# add your requirements here e.g.
# astropy >= 1.0.0
sunpy >= 3.0.0
beautifulsoup4 >= 4.8.0
drms>=0.6.1
python-dateutil >= 2.8.0
tqdm >= 4.32.1
zeep >= 3.4.0
sunpy[net] >= 3.0.0
......@@ -248,8 +248,8 @@ class KISClient(BaseClient):
data = urllib.request.urlopen(full_url)
results.append(data)
except(HTTPError, URLError) as exc:
raise type(exc)(f'Unable to execute search "{full_url}": {exc}. Confirm that '
f'RESTHeart is running on {self._BASE_URL} and connected.')
raise URLError(f'Unable to execute search "{full_url}": {exc}. Confirm that '
f'RESTHeart is running on {self._BASE_URL} and connected.')
return results # QueryResponseTable(results, client=self)
......
......@@ -67,10 +67,10 @@ def test_search(client):
if HAS_DOCKERTEST:
res = client.search(query)
else:
with pytest.raises(URLError, match=r"Unable to execute search .http://dockertest") as exc:
with pytest.raises(URLError, match=r"Unable to execute search ") as exc:
client.search(query)
# Will raise on first of multi-part OR queries.
assert "8083/sdc/zimpol_observations?filter=" in str(exc.value)
assert "http://dockertest:8083/sdc/zimpol_observations?filter=" in str(exc.value)
assert "{'description.THETA':{'$ge':{10},'$le':{85}}}" in str(exc.value)
assert "{'description.POL_STATES':" not in str(exc.value)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment