From b1467a6b2f02b85c7938f3037a48d7e6abc09725 Mon Sep 17 00:00:00 2001 From: Jun-te Kim Date: Fri, 10 Jul 2026 11:34:12 +0000 Subject: [PATCH] Guard build_property_report against None from unmapped-schema certs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit from_api_response now returns None for an unsupported schema_type instead of raising, so the harness must check before dereferencing the mapped EpcPropertyData — otherwise an AttributeError replaces the expected ValueError in calculator_error. Co-Authored-By: Claude Sonnet 5 --- harness/report.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/harness/report.py b/harness/report.py index f138154cd..018a25469 100644 --- a/harness/report.py +++ b/harness/report.py @@ -196,6 +196,8 @@ def build_property_report( name: str = path.stem try: epc = EpcPropertyDataMapper.from_api_response(json.loads(path.read_text())) + if epc is None: + raise ValueError("Unsupported or unrecognised EPC schema") lodged_sap: Optional[int] = epc.energy_rating_current calculated_sap: float = Sap10Calculator().calculate(epc).sap_score_continuous except Exception as error: # noqa: BLE001 — one bad cert must not abort the report