From 42a6e813a2433614ca0e576cfe9ef2692d3ddb58 Mon Sep 17 00:00:00 2001 From: Ben Larabie Date: Mon, 16 Dec 2024 13:39:48 -0500 Subject: [PATCH] Improving error reporting on document download (#2395) * give me the real error for doc download pls * removing status code check * Update app/clients/document_download.py Co-authored-by: Steve Astels --------- Co-authored-by: Steve Astels --- app/clients/document_download.py | 4 ++-- tests/app/clients/test_document_download.py | 3 +-- 2 files changed, 3 insertions(+), 4 deletions(-) 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"