Skip to content

Commit

Permalink
Improving error reporting on document download (#2395)
Browse files Browse the repository at this point in the history
* give me the real error for doc download pls

* removing status code check

* Update app/clients/document_download.py

Co-authored-by: Steve Astels <[email protected]>

---------

Co-authored-by: Steve Astels <[email protected]>
  • Loading branch information
ben851 and sastels authored Dec 16, 2024
1 parent 5a1826e commit 42a6e81
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
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"

0 comments on commit 42a6e81

Please sign in to comment.