Fix harvest requests exceptions

This commit is contained in:
Bruce Bolt 2019-01-31 09:30:43 +00:00 committed by Ken Tsang
parent c00ed4f6e6
commit 730b476c08
1 changed files with 3 additions and 1 deletions

View File

@ -43,8 +43,10 @@ class CKANHarvester(HarvesterBase):
try:
http_request = requests.get(url, headers=headers)
except HTTPError as e:
raise ContentFetchError('HTTP error: %s %s' % (e.response.status_code, e.request.url))
except RequestException as e:
raise ContentFetchError('HTTP error: %s' % e.code)
raise ContentFetchError('Request error: %s' % e)
except Exception as e:
raise ContentFetchError('HTTP general exception: %s' % e)
return http_request.text