跳转至

QuICTException

QuICT.tools.exception.ERROR_CODE module-attribute

ERROR_CODE = {1000: 'QuICT Exception', 1001: 'QuICT Core Module Type Exception', 1002: 'QuICT Core Module Value Exception', 1003: 'QuICT Core Module Index Exceed Exception', 1004: 'QuICT Circuit Append Operator Exception', 1005: 'QuICT Circuit Replace Operator Exception', 1006: 'QuICT Circuit Random or Supremacy Append Exception', 1007: 'QuICT DAG Circuit Exception', 1008: 'QuICT Circuit Draw Exception', 1009: 'QuICT QASM Exception', 1010: 'QuICT Qubit Measure Exception', 1011: 'QuICT CheckPointChildren no Find Exception', 1012: 'QuICT Noise Kraus Matrix Exception', 1013: 'QuICT Noise Apply Exception', 1014: 'QuICT Noise Pauli Operators Unmatched Exception', 1015: 'QuICT Noise Dampling Prob Exceed Exception', 1016: 'QuICT Gate Qubit Assigned Exception', 1017: 'QuICT Gate Parameter Exception', 1018: 'QuICT Gate Append Exception', 1019: 'QuICT Gate Matrix Exception', 1020: 'QuICT CompositeGate Append Exception', 2001: 'QuICT Simulation Sample before Run Exception', 2002: 'QuICT Simulation Gate not Implement Exception', 2003: 'QuICT Simulation Matrix Exception', 2004: 'QuICT Simulation State Vector unmatched Exception', 2005: 'QuICT Simulation Gate Algorithm not Implement Exception', 2006: 'QuICT Simulation Unitary Matrix Unmatched Exception', 2007: 'QuICT Simulation Options Unmatched Exception'}

QuICT.tools.exception.QuICTException

QuICTException(error_code: int = 1000, msg: str = None)

Bases: Exception

The base exception class for QuICT.

Parameters:

  • error_code (int, default: 1000 ) –

    the predefined QuICT error code.

  • msg (str, default: None ) –

    the description of the error. If is None, which will

Source code in QuICT/tools/exception/quict_exception.py
def __init__(self, error_code: int = 1000, msg: str = None):
    self.ecode = error_code
    self.strerror = msg if msg else ERROR_CODE[self.ecode]
    if not isinstance(self.strerror, str):
        self.strerror = str(msg)