Skip to content

HttpHandler post response is lost when http error #302

@melissaBenzie

Description

@melissaBenzie

this:
https://github.com/CareEvolution/OrchestrateSDK/blob/main/python/orchestrate/_internal/http_handler.py#L195

calls this, which sets the response.reason and raises a http error with a specific message.

https://requests.readthedocs.io/en/latest/_modules/requests/models/#Response.raise_for_status

So that gets captured by:
https://github.com/CareEvolution/OrchestrateSDK/blob/main/python/orchestrate/_internal/http_handler.py#L167
https://github.com/CareEvolution/OrchestrateSDK/blob/main/python/orchestrate/_internal/http_handler.py#L110

which loses the original response.status_code and reason as it's just pasing the response.text which is empty.

Image

and we end up with a not very useful exception unless we look at the traceback:

Image

traceback:

Traceback (most recent call last):\n  File "c:\\CareEvolution\\CadenceEventProcessor\\.venv\\Lib\\site-packages\\orchestrate\\_internal\\http_handler.py", line 165, in post\n    response.raise_for_status()\n    ~~~~~~~~~~~~~~~~~~~~~~~~~^^\n  File "c:\\CareEvolution\\CadenceEventProcessor\\.venv\\Lib\\site-packages\\requests\\models.py", line 1026, in raise_for_status\n    raise HTTPError(http_error_msg, response=self)\nrequests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://ramjet-paddle-ew41.instances.careevolution.io/mpi/v1/match/fhir\n\nThe above exception was the direct cause of the following exception:\n\nTraceback (most recent call last):\n  File "C:\\CareEvolution\\CadenceEventProcessor\\event_processor\\_internal\\providers\\identity_api_provider.py", line 122, in match\n    match_response = self.__http_handler.post(path, body=fhir_patient_dict)\n  File "c:\\CareEvolution\\CadenceEventProcessor\\.venv\\Lib\\site-packages\\orchestrate\\_internal\\http_handler.py", line 167, in post...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions