Error package

Module contents

Many of the functions in ths library apply some kind of validation on the input parameters. If the inputs are not valid, they may raise an exception.

To make as clear as possible what went wrong, this package includes a number of custom exceptions that try to be as explicit as possible.

exception qclight.error.BinaryStringError(invalid_string)[source]

Bases: ValueError

Raised when the string received is not the string representation of a number in binary.

exception qclight.error.BitValueError(invalid_number)[source]

Bases: ValueError

Raised when the value received is not a single bit. The value expected was either 0 or 1.

exception qclight.error.OutOfRangeError(max_range, min_range=None, invalid_index=None)[source]

Bases: IndexError

Raised when the index received is out of range.

exception qclight.error.PositiveValueError(invalid_number)[source]

Bases: ValueError

Raised when the value received is not positive. It means it is less or equal to 0.

exception qclight.error.PowerOfTwoError(invalid_number)[source]

Bases: ValueError

Raised when the number received is not a power of 2.

exception qclight.error.PowerOfTwoLengthError(invalid_number)[source]

Bases: ValueError

Raised when the length of the vector received is not a power of 2.