diff --git a/app/clients/document_download.py b/app/clients/document_download.py index 5908c880e5..7a5ceaaf5c 100644 --- a/app/clients/document_download.py +++ b/app/clients/document_download.py @@ -13,8 +13,8 @@ def from_exception(cls, e): message = e.response.json()["error"] status_code = e.response.status_code except (TypeError, ValueError, AttributeError, KeyError): - message = "connection error" - status_code = 503 + message = "error connecting to document download" + status_code = e.response.status_code if e.response else 503 return cls(message, status_code) diff --git a/tests/app/clients/test_document_download.py b/tests/app/clients/test_document_download.py index dd0960a0b0..4dffabb7a4 100644 --- a/tests/app/clients/test_document_download.py +++ b/tests/app/clients/test_document_download.py @@ -101,5 +101,4 @@ def test_should_raise_for_connection_errors(document_download): document_download.upload_document("service-id", {"file": "abababab", "sending_method": "attach"}) - assert excinfo.value.message == "connection error" - assert excinfo.value.status_code == 503 + assert excinfo.value.message == "error connecting to document download"