Skip to content

Commit 8fc4860

Browse files
committed
add validation error if measurement id analysis fails
1 parent 9dfacf0 commit 8fc4860

File tree

1 file changed

+9
-3
lines changed
  • src/bloqade/gemini/analysis/measurement_validation

1 file changed

+9
-3
lines changed

src/bloqade/gemini/analysis/measurement_validation/impls.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,16 @@ def terminal_measure(
6262
measurement_analysis_results = interp.measurement_analysis_results
6363
total_qubits_allocated = interp.unique_qubits_allocated
6464

65-
# could make these proper exceptions but would be tricky to communicate to user
66-
# without revealing under-the-hood details
6765
measure_lattice_element = measurement_analysis_results.get(stmt.result)
68-
assert isinstance(measure_lattice_element, MeasureIdTuple)
66+
if not isinstance(measure_lattice_element, MeasureIdTuple):
67+
interp.add_validation_error(
68+
stmt,
69+
ir.ValidationError(
70+
stmt,
71+
"Measurement ID Analysis failed to produce the necessary results needed for vaolidation.",
72+
),
73+
)
74+
return (interp.lattice.bottom(),)
6975

7076
if len(measure_lattice_element.data) != total_qubits_allocated:
7177
interp.add_validation_error(

0 commit comments

Comments
 (0)