Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving error reporting on document download #2395

Merged
merged 3 commits into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/clients/document_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 1 addition & 2 deletions tests/app/clients/test_document_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Loading