Skip to content

Commit

Permalink
Add headers for exceptions (#713)
Browse files Browse the repository at this point in the history
Quick fix to use the same logic for functions and exceptions. Closes
#712.

A known problem with this implementation is that some headings should
not be `h3`, but it depends on the page. See
#714.
  • Loading branch information
frankharkins authored Jan 26, 2024
1 parent d55673b commit 4381020
Show file tree
Hide file tree
Showing 16 changed files with 132 additions and 12 deletions.
2 changes: 2 additions & 0 deletions docs/api/qiskit/algorithms.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,8 @@ Algorithms that compute the fidelity of pairs of quantum states.

### Exceptions

### AlgorithmError

<span id="qiskit.algorithms.AlgorithmError" />

`qiskit.algorithms.AlgorithmError(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/algorithms/exceptions.py "view source code")
Expand Down
2 changes: 2 additions & 0 deletions docs/api/qiskit/circuit.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,8 @@ constructed circuit

Almost all circuit functions and methods will raise a [`CircuitError`](#qiskit.circuit.CircuitError "qiskit.circuit.CircuitError") when encountering an error that is particular to usage of Qiskit (as opposed to regular typing or indexing problems, which will typically raise the corresponding standard Python error).

### CircuitError

<span id="qiskit.circuit.CircuitError" />

`qiskit.circuit.CircuitError(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/circuit/exceptions.py "view source code")
Expand Down
4 changes: 4 additions & 0 deletions docs/api/qiskit/dagcircuit.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ python_api_name: qiskit.dagcircuit

## Exceptions

### DAGCircuitError

<span id="qiskit.dagcircuit.DAGCircuitError" />

`qiskit.dagcircuit.DAGCircuitError(*msg)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/dagcircuit/exceptions.py "view source code")
Expand All @@ -40,6 +42,8 @@ Base class for errors raised by the DAGCircuit object.

Set the error message.

### DAGDependencyError

<span id="qiskit.dagcircuit.DAGDependencyError" />

`qiskit.dagcircuit.DAGDependencyError(*msg)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/dagcircuit/exceptions.py "view source code")
Expand Down
8 changes: 8 additions & 0 deletions docs/api/qiskit/exceptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ python_api_name: qiskit.exceptions

All Qiskit-related errors raised by Qiskit are subclasses of the base:

### QiskitError

<span id="qiskit.exceptions.QiskitError" />

`qiskit.exceptions.QiskitError(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/exceptions.py "view source code")
Expand All @@ -36,6 +38,8 @@ Many of the Qiskit subpackages define their own more granular error, to help in

Qiskit has several optional features that depend on other packages that are not required for a minimal install. You can read more about those, and ways to check for their presence, in [`qiskit.utils.optionals`](utils#module-qiskit.utils.optionals "qiskit.utils.optionals"). Trying to use a feature that requires an optional extra will raise a particular error, which subclasses both [`QiskitError`](#qiskit.exceptions.QiskitError "qiskit.exceptions.QiskitError") and the Python built-in `ImportError`.

### MissingOptionalLibraryError

<span id="qiskit.exceptions.MissingOptionalLibraryError" />

`qiskit.exceptions.MissingOptionalLibraryError(libname, name, pip_install=None, msg=None)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/exceptions.py "view source code")
Expand All @@ -46,6 +50,8 @@ Set the error message. :param libname: Name of missing library :param name: Name

Two more uncommon errors relate to failures in reading user-configuration files, or specifying a filename that cannot be used:

### QiskitUserConfigError

<span id="qiskit.exceptions.QiskitUserConfigError" />

`qiskit.exceptions.QiskitUserConfigError(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/exceptions.py "view source code")
Expand All @@ -54,6 +60,8 @@ Raised when an error is encountered reading a user config file.

Set the error message.

### InvalidFileError

<span id="qiskit.exceptions.InvalidFileError" />

`qiskit.exceptions.InvalidFileError(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/exceptions.py "view source code")
Expand Down
2 changes: 2 additions & 0 deletions docs/api/qiskit/extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ python_api_name: qiskit.extensions

The additional gates in this module will tend to raise a custom exception when they encounter problems.

### ExtensionError

<span id="qiskit.extensions.ExtensionError" />

`qiskit.extensions.ExtensionError(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/extensions/exceptions.py "view source code")
Expand Down
2 changes: 2 additions & 0 deletions docs/api/qiskit/opflow.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@ the double commutator

## Exceptions

### OpflowError

<span id="qiskit.opflow.OpflowError" />

`qiskit.opflow.OpflowError(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/opflow/exceptions.py "view source code")
Expand Down
2 changes: 2 additions & 0 deletions docs/api/qiskit/passmanager.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,8 @@ With the pass manager framework, a developer can flexibly customize the optimiza

### Exceptions

### PassManagerError

<span id="qiskit.passmanager.PassManagerError" />

`qiskit.passmanager.PassManagerError(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/passmanager/exceptions.py "view source code")
Expand Down
10 changes: 10 additions & 0 deletions docs/api/qiskit/providers.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ It’s worth pointing out that Terra’s version support policy doesn’t mean p

### Exceptions

### QiskitBackendNotFoundError

<span id="qiskit.providers.QiskitBackendNotFoundError" />

`qiskit.providers.QiskitBackendNotFoundError(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/providers/exceptions.py "view source code")
Expand All @@ -83,6 +85,8 @@ Base class for errors raised while looking for a backend.

Set the error message.

### BackendPropertyError

<span id="qiskit.providers.BackendPropertyError" />

`qiskit.providers.BackendPropertyError(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/providers/exceptions.py "view source code")
Expand All @@ -91,6 +95,8 @@ Base class for errors raised while looking for a backend property.

Set the error message.

### JobError

<span id="qiskit.providers.JobError" />

`qiskit.providers.JobError(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/providers/exceptions.py "view source code")
Expand All @@ -99,6 +105,8 @@ Base class for errors raised by Jobs.

Set the error message.

### JobTimeoutError

<span id="qiskit.providers.JobTimeoutError" />

`qiskit.providers.JobTimeoutError(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/providers/exceptions.py "view source code")
Expand All @@ -107,6 +115,8 @@ Base class for timeout errors raised by jobs.

Set the error message.

### BackendConfigurationError

<span id="qiskit.providers.BackendConfigurationError" />

`qiskit.providers.BackendConfigurationError(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/providers/exceptions.py "view source code")
Expand Down
10 changes: 10 additions & 0 deletions docs/api/qiskit/pulse.md
Original file line number Diff line number Diff line change
Expand Up @@ -2897,6 +2897,8 @@ The number of samples for the time to elapse

## Exceptions

### PulseError

<span id="qiskit.pulse.PulseError" />

`qiskit.pulse.PulseError(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/pulse/exceptions.py "view source code")
Expand All @@ -2905,6 +2907,8 @@ Errors raised by the pulse module.

Set the error message.

### BackendNotSet

<span id="qiskit.pulse.BackendNotSet" />

`qiskit.pulse.BackendNotSet(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/pulse/exceptions.py "view source code")
Expand All @@ -2913,6 +2917,8 @@ Raised if the builder context does not have a backend.

Set the error message.

### NoActiveBuilder

<span id="qiskit.pulse.NoActiveBuilder" />

`qiskit.pulse.NoActiveBuilder(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/pulse/exceptions.py "view source code")
Expand All @@ -2921,6 +2927,8 @@ Raised if no builder context is active.

Set the error message.

### UnassignedDurationError

<span id="qiskit.pulse.UnassignedDurationError" />

`qiskit.pulse.UnassignedDurationError(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/pulse/exceptions.py "view source code")
Expand All @@ -2929,6 +2937,8 @@ Raised if instruction duration is unassigned.

Set the error message.

### UnassignedReferenceError

<span id="qiskit.pulse.UnassignedReferenceError" />

`qiskit.pulse.UnassignedReferenceError(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/pulse/exceptions.py "view source code")
Expand Down
6 changes: 6 additions & 0 deletions docs/api/qiskit/qasm2.md
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ An OpenQASM 2 string representing the circuit.

This module defines a generic error type that derives from [`QiskitError`](exceptions#qiskit.exceptions.QiskitError "qiskit.exceptions.QiskitError") that can be used as a catch when you care about failures emitted by the interoperation layer specifically.

### QASM2Error

<span id="qiskit.qasm2.QASM2Error" />

`qiskit.qasm2.QASM2Error(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/qasm2/exceptions.py "view source code")
Expand All @@ -180,6 +182,8 @@ Set the error message.

In cases where the lexer or parser fails due to an invalid OpenQASM 2 file, the conversion functions will raise a more specific error with a message explaining what the failure is, and where in the file it occurred.

### QASM2ParseError

<span id="qiskit.qasm2.QASM2ParseError" />

`qiskit.qasm2.QASM2ParseError(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/qasm2/exceptions.py "view source code")
Expand All @@ -190,6 +194,8 @@ Set the error message.

When the exporters fail to export a circuit, likely because it has structure that cannot be represented by OpenQASM 2.0, they will also emit a custom error.

### QASM2ExportError

<span id="qiskit.qasm2.QASM2ExportError" />

`qiskit.qasm2.QASM2ExportError(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/qasm2/exceptions.py "view source code")
Expand Down
4 changes: 4 additions & 0 deletions docs/api/qiskit/qasm3.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ Convert the circuit to OpenQASM 3, returning the result as a string.

All of these interfaces will raise [`QASM3ExporterError`](#qiskit.qasm3.QASM3ExporterError "qiskit.qasm3.QASM3ExporterError") on failure.

### QASM3ExporterError

<span id="qiskit.qasm3.QASM3ExporterError" />

`qiskit.qasm3.QASM3ExporterError(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/qasm3/exceptions.py "view source code")
Expand Down Expand Up @@ -234,6 +236,8 @@ a circuit representation of the OpenQASM 3 program.

Both of these two functions raise [`QASM3ImporterError`](#qiskit.qasm3.QASM3ImporterError "qiskit.qasm3.QASM3ImporterError") on failure.

### QASM3ImporterError

<span id="qiskit.qasm3.QASM3ImporterError" />

`qiskit.qasm3.QASM3ImporterError(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/qasm3/exceptions.py "view source code")
Expand Down
2 changes: 2 additions & 0 deletions docs/api/qiskit/qpy.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ Which will save the qpy serialized circuit to the provided file.

These functions will raise a custom subclass of [`QiskitError`](exceptions#qiskit.exceptions.QiskitError "qiskit.exceptions.QiskitError") if they encounter problems during serialization or deserialization.

### QpyError

<span id="qiskit.qpy.QpyError" />

`qiskit.qpy.QpyError(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/qpy/exceptions.py "view source code")
Expand Down
8 changes: 8 additions & 0 deletions docs/api/qiskit/transpiler.md
Original file line number Diff line number Diff line change
Expand Up @@ -938,6 +938,8 @@ See [https://arxiv.org/abs/2102.01682](https://arxiv.org/abs/2102.01682) for mor

### Exceptions

### TranspilerError

<span id="qiskit.transpiler.TranspilerError" />

`qiskit.transpiler.TranspilerError(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/transpiler/exceptions.py "view source code")
Expand All @@ -946,6 +948,8 @@ Exceptions raised during transpilation.

Set the error message.

### TranspilerAccessError

<span id="qiskit.transpiler.TranspilerAccessError" />

`qiskit.transpiler.TranspilerAccessError(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/transpiler/exceptions.py "view source code")
Expand All @@ -954,6 +958,8 @@ DEPRECATED: Exception of access error in the transpiler passes.

Set the error message.

### CouplingError

<span id="qiskit.transpiler.CouplingError" />

`qiskit.transpiler.CouplingError(*msg)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/transpiler/exceptions.py "view source code")
Expand All @@ -962,6 +968,8 @@ Base class for errors raised by the coupling graph object.

Set the error message.

### LayoutError

<span id="qiskit.transpiler.LayoutError" />

`qiskit.transpiler.LayoutError(*msg)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/transpiler/exceptions.py "view source code")
Expand Down
2 changes: 2 additions & 0 deletions docs/api/qiskit/visualization.md
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ You can find code examples for each visualization functions on the individual fu

## Exceptions

### VisualizationError

<span id="qiskit.visualization.VisualizationError" />

`qiskit.visualization.VisualizationError(*message)`[GitHub](https://github.com/qiskit/qiskit/tree/stable/0.45/qiskit/visualization/exceptions.py "view source code")
Expand Down
Loading

0 comments on commit 4381020

Please sign in to comment.