qiskit icon indicating copy to clipboard operation
qiskit copied to clipboard

Granular exception hierarchy for TranspilerErrors

Open dolph opened this issue 1 year ago • 2 comments

What should we add?

In order to handle different types of TranspilerErrors dynamically, we need many more granular exception classes similar to what was done for CircuitTooWideForTarget.

Basically, every instance of "raise TranspilerError(" should be instead be replaced with an exception class that extends TranspilerError (this provides backwards compatibility for code already catching TranspilerError). There are a lot of them, but my prioritized list would start with errors like:

  1. TranspilerError: "Unknown operation type for DAGOpNode(op=Instruction(name='reset', num_qubits=1, num_clbits=0, params=[]), qargs=(Qubit(QuantumRegister(127, 'q'), 35),), cargs=()).
  2. TranspilerError: 'The input circuit None is not scheduled. Call one of scheduling passes before running the ConstrainedReschedule pass.
  3. TranspilerError: 'Conditional instruction measure is not supported in ALAP scheduler.
  4. TranspilerError: 'Number of qubits greater than device.
  5. TranspilerError: 'Conditional instruction reset is not supported in ALAP scheduler.

dolph avatar Nov 30 '23 14:11 dolph

Hi, I keep getting the 1 st type of error listed above. Any idea why? The code used to work fine.

derenliu avatar Jan 04 '24 20:01 derenliu

Can we get this issue prioritised ?

Adding to the list above is one more frequent error :-

TranspilerError: 'The length of the layout is different than the size of the circuit: 16 <> 133

rahulnitsxr2016 avatar Feb 04 '24 06:02 rahulnitsxr2016