qrunch.common.errors

Module that contains all non native errors that the core module can raise.

Exceptions

AbstractIndexError

Error that is raised when an error occurs while accessing abstract indices.

AssignAbstractIndexError

Error that is raised when an error occurs while assigning an abstract index.

BackendError

Error that a backend raises when the backend fails.

BackendSetupError

Error that a backend raises when the backend set-up fails.

BoundsError

The bounds were not accepted.

CheckpointError

An error occurred when trying to handle checkpoint data.

CircuitError

Error that a circuit raises.

DataPersisterError

An error occurred when trying to load or save data.

EstimatorError

Error that an Estimator raises.

GateError

Error that a Gate raises.

GatePoolError

Error that a gate pool or gate pool operator raises.

GateSelectionError

Error during gate selection.

GrouperError

Error that a Grouper raises.

HybridJobError

An error occurred when running a hybrid job.

InternalError

QrunchError raised when unexpected behavior happens.

InternalPySCFError

Error raised when an error occurs unexpectedly within pyscf.

JordanWignerIndexError

Error raised when the index input for the operators in the Jordan-Wigner map are not integers.

KrausError

An error occurred in the Kraus operation.

LayoutSynthesizerError

Error that a layout synthesizer raises.

MalformedXyzFileError

Raised when the XYZ file is malformed or cannot be read.

MetadataHashError

An error raised when calculating metadata hashes.

NotConvergedError

Error raised when a molecular solver does not converge.

OptimizationError

The optimization was not successful.

OptionsValidationError

Raised when errors were found during options validation.

ProviderError

An error occurred when trying to interact with a provider.

PublicAPIError

An error occurred in the public API handling.

QrunchError

Error issued from the Qrunch code.

RotationError

An error occurred when trying to rotate a hermitian operator.

SamplerError

Error that a Sampler raises.

SerializerError

An error occurred when trying to serialize/deserialize data.

TranspilerError

Error thrown by a transpiler.

UnspecifiedParametersError

A Circuit was not fully specified before transpilation.

UnsupportedCallbackError

Raised when an optimization method does not support callback functions.

VQEError

Error thrown by the VQE.

VQEValidationError

The circuit and operator did not pass validation.

ValidationError

Raised when errors were found during validation.

exception AbstractIndexError

Bases: QrunchError

Error that is raised when an error occurs while accessing abstract indices.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception AssignAbstractIndexError

Bases: QrunchError

Error that is raised when an error occurs while assigning an abstract index.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception BackendError

Bases: QrunchError

Error that a backend raises when the backend fails.

This error automatically saves the error log to current working directory if not overwritten.

__init__(message: str, error_log: str | None = None) None

Initialize the BackendError.

Parameters:
  • message (str)

  • error_log (str | None)

Return type:

None

classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception BackendSetupError

Bases: BackendError

Error that a backend raises when the backend set-up fails.

__init__(message: str, error_log: str | None = None) None

Initialize the BackendError.

Parameters:
  • message (str)

  • error_log (str | None)

Return type:

None

classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception BoundsError

Bases: QrunchError

The bounds were not accepted.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception CheckpointError

Bases: QrunchError

An error occurred when trying to handle checkpoint data.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception CircuitError

Bases: QrunchError

Error that a circuit raises.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception DataPersisterError

Bases: QrunchError

An error occurred when trying to load or save data.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception EstimatorError

Bases: QrunchError

Error that an Estimator raises.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception GateError

Bases: QrunchError

Error that a Gate raises.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception GatePoolError

Bases: QrunchError

Error that a gate pool or gate pool operator raises.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception GateSelectionError

Bases: QrunchError

Error during gate selection.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception GrouperError

Bases: QrunchError

Error that a Grouper raises.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception HybridJobError

Bases: QrunchError

An error occurred when running a hybrid job.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception InternalError

Bases: QrunchError

QrunchError raised when unexpected behavior happens.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception InternalPySCFError

Bases: QrunchError

Error raised when an error occurs unexpectedly within pyscf.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception JordanWignerIndexError

Bases: QrunchError

Error raised when the index input for the operators in the Jordan-Wigner map are not integers.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception KrausError

Bases: QrunchError

An error occurred in the Kraus operation.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception LayoutSynthesizerError

Bases: QrunchError

Error that a layout synthesizer raises.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception MalformedXyzFileError

Bases: QrunchError

Raised when the XYZ file is malformed or cannot be read.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception MetadataHashError

Bases: QrunchError

An error raised when calculating metadata hashes.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception NotConvergedError

Bases: QrunchError

Error raised when a molecular solver does not converge.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception OptimizationError

Bases: QrunchError

The optimization was not successful.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception OptionsValidationError

Bases: ValidationError

Raised when errors were found during options validation.

__init__(message: str = 'Errors found during validation.', errors: list[str] | None = None) None

Initialize error.

Parameters:
  • message (str) – Basic error message. Defaults to “Errors found during validation.”.

  • errors (list[str] | None) – The list of error messages for the errors found. Defaults to None.

Return type:

None

classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception ProviderError

Bases: QrunchError

An error occurred when trying to interact with a provider.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception PublicAPIError

Bases: QrunchError

An error occurred in the public API handling.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception QrunchError

Bases: Exception

Error issued from the Qrunch code.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception RotationError

Bases: QrunchError

An error occurred when trying to rotate a hermitian operator.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception SamplerError

Bases: QrunchError

Error that a Sampler raises.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception SerializerError

Bases: QrunchError

An error occurred when trying to serialize/deserialize data.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception TranspilerError

Bases: QrunchError

Error thrown by a transpiler.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception UnspecifiedParametersError

Bases: TranspilerError

A Circuit was not fully specified before transpilation.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception UnsupportedCallbackError

Bases: QrunchError

Raised when an optimization method does not support callback functions.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception VQEError

Bases: QrunchError

Error thrown by the VQE.

__init__(*args, **kwargs)
classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception VQEValidationError

Bases: ValidationError

The circuit and operator did not pass validation.

__init__(message: str = 'Errors found during validation.', errors: list[str] | None = None) None

Initialize error.

Parameters:
  • message (str) – Basic error message. Defaults to “Errors found during validation.”.

  • errors (list[str] | None) – The list of error messages for the errors found. Defaults to None.

Return type:

None

classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception ValidationError

Bases: QrunchError

Raised when errors were found during validation.

__init__(message: str = 'Errors found during validation.', errors: list[str] | None = None) None

Initialize error.

Parameters:
  • message (str) – Basic error message. Defaults to “Errors found during validation.”.

  • errors (list[str] | None) – The list of error messages for the errors found. Defaults to None.

Return type:

None

classmethod __new__(*args, **kwargs)
add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

Modules

error_logging

Module for handling error logs.