Raise ValueError with all errors if extraction is invalid.
(data: dict)
| 104 | |
| 105 | |
| 106 | def assert_valid(data: dict) -> None: |
| 107 | """Raise ValueError with all errors if extraction is invalid.""" |
| 108 | errors = validate_extraction(data) |
| 109 | if errors: |
| 110 | msg = f"Extraction JSON has {len(errors)} error(s):\n" + "\n".join(f" • {e}" for e in errors) |
| 111 | raise ValueError(msg) |