Skip to content

exceptions

This module contains all custom exception used by OpenSquirrel.

ExporterError

Bases: Exception

Should be raised when a circuit cannot be exported to the desired output format.

Source code in opensquirrel/exceptions.py
class ExporterError(Exception):
    """Should be raised when a circuit cannot be exported to the desired output format."""

NoRoutingPathError

Bases: Exception

Should be raised when no routing path is available between qubits.

Source code in opensquirrel/exceptions.py
class NoRoutingPathError(Exception):
    """Should be raised when no routing path is available between qubits."""

    def __init__(self, message: str, *args: Any) -> None:
        """Init of the ``NoRoutingPathError``.

        Args:
            message: Error message.
        """
        super().__init__(message, *args)

__init__(message, *args)

Init of the NoRoutingPathError.

Parameters:

Name Type Description Default
message str

Error message.

required
Source code in opensquirrel/exceptions.py
def __init__(self, message: str, *args: Any) -> None:
    """Init of the ``NoRoutingPathError``.

    Args:
        message: Error message.
    """
    super().__init__(message, *args)

UnsupportedGateError

Bases: Exception

Should be raised when a gate is not supported.

Source code in opensquirrel/exceptions.py
class UnsupportedGateError(Exception):
    """Should be raised when a gate is not supported."""

    def __init__(self, gate: Any, *args: Any) -> None:
        """Init of the ``UnsupportedGateError``.

        Args:
            gate: Gate that is not supported.
        """
        super().__init__(f"{gate} not supported", *args)

__init__(gate, *args)

Init of the UnsupportedGateError.

Parameters:

Name Type Description Default
gate Any

Gate that is not supported.

required
Source code in opensquirrel/exceptions.py
def __init__(self, gate: Any, *args: Any) -> None:
    """Init of the ``UnsupportedGateError``.

    Args:
        gate: Gate that is not supported.
    """
    super().__init__(f"{gate} not supported", *args)