Errors
qsimlab.errors
¶
Exception hierarchy of qsimlab (see python/API.md §4).
Every exception derives from QsimError and from the closest
built-in exception, so except ValueError keeps working:
>>> import qsimlab
>>> c = qsimlab.Circuit(2)
>>> try:
... c.h(5)
... except IndexError as e:
... print(type(e).__name__)
QubitIndexError
QsimError
¶
Bases: Exception
Base class of every qsimlab error.
CircuitError
¶
Bases: QsimError, ValueError
Invalid circuit construction: bad gate name or arity, repeated qubit, bad probability.
QubitIndexError
¶
Bases: QsimError, IndexError
A qubit, classical bit or basis-state index is out of range.
UnsupportedOperationError
¶
Bases: QsimError, ValueError
The request, engine or export format cannot handle an operation of the circuit.
ResourceLimitError
¶
Bases: QsimError, MemoryError
A register or term count would exceed the budget.
Attributes needed and limit hold the requested and allowed amounts
(bytes for memory, count for Pauli terms) when known.