microsoft/qdk
Publicmirrored from https://github.com/microsoft/qdkAvailable
source/pip/qsharp/interop/qiskit/backends/errors.py
29lines · modecode
| 1 | # Copyright (c) Microsoft Corporation. |
| 2 | # Licensed under the MIT License. |
| 3 | |
| 4 | from enum import Enum |
| 5 | |
| 6 | |
| 7 | class Errors(Enum): |
| 8 | UNRESTRICTED_INVALID_QIR_TARGET = 1 |
| 9 | RUN_TERMINATED_WITHOUT_OUTPUT = 2 |
| 10 | FAILED_TO_EXPORT_QASM = 3 |
| 11 | MISSING_NUMBER_OF_SHOTS = 4 |
| 12 | INPUT_MUST_BE_QC = 5 |
| 13 | ONLY_ONE_CIRCUIT_ALLOWED = 6 |
| 14 | |
| 15 | def __str__(self): |
| 16 | if self == Errors.UNRESTRICTED_INVALID_QIR_TARGET: |
| 17 | return "The Unrestricted profile is not valid when generating QIR." |
| 18 | elif self == Errors.RUN_TERMINATED_WITHOUT_OUTPUT: |
| 19 | return "Run terminated without valid output." |
| 20 | elif self == Errors.FAILED_TO_EXPORT_QASM: |
| 21 | return "Failed to export QASM source." |
| 22 | elif self == Errors.MISSING_NUMBER_OF_SHOTS: |
| 23 | return "The number of shots must be specified." |
| 24 | elif self == Errors.INPUT_MUST_BE_QC: |
| 25 | return "Input must be a QuantumCircuit." |
| 26 | elif self == Errors.ONLY_ONE_CIRCUIT_ALLOWED: |
| 27 | return "Only one QuantumCircuit can be estimated at a time." |
| 28 | else: |
| 29 | return "Unknown option." |
| 30 | |