diff --git a/infrastructure/abri/abri_client.py b/infrastructure/abri/abri_client.py index bd63f056a..9731431e2 100644 --- a/infrastructure/abri/abri_client.py +++ b/infrastructure/abri/abri_client.py @@ -10,6 +10,7 @@ from domain.abri.models import ( ) from infrastructure.abri.config import AbriConfig from infrastructure.abri.envelope import serialise_relay_request +from infrastructure.abri.errors import AbriTransportError STD_JOB_CODE = "SCSEXT" CLIENT_CODE = "HSG" @@ -39,7 +40,11 @@ class AbriClient: username=self._config.username, password=self._config.password, ) - response = self._session.post(self._config.endpoint_url, data=body) + try: + response = self._session.post(self._config.endpoint_url, data=body) + response.raise_for_status() + except requests.HTTPError as error: + raise AbriTransportError(str(error)) from error root = ET.fromstring(response.content) if root.tag == "response": return self._parse_rejection(root)