"""You will find here the custom exceptions we created in order to provide
clearer errors. When relevant, we also append the trace of the error raised by a
provider's SDK."""
[docs]
class InstructionParsingError(ValueError):
"""Raised when an QASM instruction encountered by the parser is malformed."""
[docs]
class InstructionAfterMeasurementError(ValueError):
"""Raised when one tries to add an instruction after a measurement in a
circuit."""
[docs]
class NumberQubitsError(ValueError):
"""Raised when the number of qubits defining an instruction, a gate, or a
measurement, is not coherent with the related objects (circuit, matrix,
observable, etc...)."""
[docs]
class NumberQubitsWarning(UserWarning):
"""Raised when the number of qubits defining an instruction, a gate, or a
measurement, is not coherent with the related objects (circuit, matrix,
observable, etc...)."""
[docs]
class ResultAttributeError(AttributeError):
"""Raised when one tries to access the attribute of the result that is
incoherent with the associated job."""
[docs]
class DeviceJobIncompatibleError(ValueError):
"""Raised when one tries to run a job with a JobType that is not suitable
for the selected device (for example SAMPLE job on a statevector simulator)."""
[docs]
class DeviceJobIncompatibleWarning(UserWarning):
"""A warning is issued when a job is not compatible with the selected device."""
[docs]
class RemoteExecutionError(ConnectionError):
"""Raised when an error occurred during a remote connection, submission or
execution."""
[docs]
class IBMRemoteExecutionError(RemoteExecutionError):
"""Raised when an error occurred during the remote execution process of
job(s) on an IBM device."""
[docs]
class IBMNoiseModelGeneration(UserWarning):
"""Warning for potential compatibility issues with IBM noise model."""
[docs]
class QLMRemoteExecutionError(RemoteExecutionError):
"""Raised when an error occurred during the remote execution process of
job(s) on the remote QLM."""
[docs]
class AWSBraketRemoteExecutionError(RemoteExecutionError):
"""Raised when an error occurred during the remote execution process of
job(s) on the remote Amazon Braket."""
[docs]
class UnsupportedBraketFeaturesWarning(UserWarning):
"""Warning for potential compatibility issues with Braket."""
[docs]
class OpenQASMTranslationWarning(UserWarning):
"""Warning for potential translation error when exporting to OpenQASM."""
[docs]
class AdditionalGateNoiseWarning(UserWarning):
"""Warning for additional noise on native gate used in the decomposition of
noisy gate."""
[docs]
class NonReversibleWarning(UserWarning):
"""Warning for nonreversible instruction used in inverse function."""