|
10 | 10 | # copyright notice, and modified files need to carry a notice indicating |
11 | 11 | # that they have been altered from the originals. |
12 | 12 |
|
13 | | -"""Exceptions for errors raised by Qiskit.""" |
| 13 | +""" |
| 14 | +=============================================== |
| 15 | +Top-level exceptions (:mod:`qiskit.exceptions`) |
| 16 | +=============================================== |
| 17 | +
|
| 18 | +All Qiskit-related errors raised by Qiskit are subclasses of the base: |
| 19 | +
|
| 20 | +.. autoexception:: QiskitError |
| 21 | +
|
| 22 | +.. note:: |
| 23 | +
|
| 24 | + Errors that are just general programming errors, such as incorrect typing, may still raise |
| 25 | + standard Python errors such as ``TypeError``. :exc:`QiskitError` is generally for errors raised |
| 26 | + in usage that is particular to Qiskit. |
| 27 | +
|
| 28 | +Many of the Qiskit subpackages define their own more granular error, to help in catching only the |
| 29 | +subset of errors you care about. For example, :mod:`qiskit.circuit` almost exclusively uses |
| 30 | +:exc:`.CircuitError`, while both :exc:`.QASM2ExportError` and :exc:`.QASM2ParseError` derive from |
| 31 | +:exc:`.QASM2Error` in :mod:`qiskit.qasm2`, which is in turn a type of :exc:`.QiskitError`. |
| 32 | +
|
| 33 | +Qiskit has several optional features that depend on other packages that are not required for a |
| 34 | +minimal install. You can read more about those, and ways to check for their presence, in |
| 35 | +:mod:`qiskit.utils.optionals`. Trying to use a feature that requires an optional extra will raise a |
| 36 | +particular error, which subclasses both :exc:`QiskitError` and the Python built-in ``ImportError``. |
| 37 | +
|
| 38 | +.. autoexception:: MissingOptionalLibraryError |
| 39 | +
|
| 40 | +Two more uncommon errors relate to failures in reading user-configuration files, or specifying a |
| 41 | +filename that cannot be used: |
| 42 | +
|
| 43 | +.. autoexception:: QiskitUserConfigError |
| 44 | +.. autoexception:: InvalidFileError |
| 45 | +""" |
14 | 46 |
|
15 | 47 | from typing import Optional |
16 | 48 |
|
|
0 commit comments