mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-03 09:51:11 -05:00
Merge pull request #3072 from alphagov/doc-dl-exc
handle doc dl connection errors correctly
This commit is contained in:
@@ -42,7 +42,9 @@ class DocumentDownloadClient:
|
||||
# if doc dl responds with a non-400, (eg 403) it's referring to credentials that the API and Doc DL use.
|
||||
# we don't want to tell users about that, so anything that isn't a 400 (virus scan failed or file type
|
||||
# unrecognised) should be raised as a 500 internal server error here.
|
||||
if e.response.status_code == 400:
|
||||
if e.response is None:
|
||||
raise Exception(f'Unhandled document download error: {repr(e)}')
|
||||
elif e.response.status_code == 400:
|
||||
error = DocumentDownloadError.from_exception(e)
|
||||
current_app.logger.info(
|
||||
'Document download request failed with error: {}'.format(error.message)
|
||||
|
||||
Reference in New Issue
Block a user