Abri log_job treats a malformed relay response as retriable, never as success or rejection 🟩

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Daniel Roth 2026-07-03 14:29:41 +00:00
parent ff34872c24
commit 0df1d866fe

View file

@ -10,7 +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
from infrastructure.abri.errors import AbriResponseParseError, AbriTransportError
STD_JOB_CODE = "SCSEXT"
CLIENT_CODE = "HSG"
@ -45,7 +45,10 @@ class AbriClient:
response.raise_for_status()
except requests.RequestException as error:
raise AbriTransportError(str(error)) from error
root = ET.fromstring(response.content)
try:
root = ET.fromstring(response.content)
except ET.ParseError as error:
raise AbriResponseParseError(str(error)) from error
if root.tag == "response":
return self._parse_rejection(root)
job_logged = root.find("Jobs/Job_logged")