Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Exceptions should inherit from Terra where suitable #741

Merged
merged 2 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions qiskit_ibm_provider/qpy/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@

"""Exception for errors raised by the pulse module."""
from typing import Any
from qiskit.exceptions import QiskitError
from qiskit.qpy.exceptions import QpyError
from ..exceptions import IBMError


class QpyError(QiskitError):
class IBMQpyError(QpyError, IBMError):
"""Errors raised by the qpy module."""

def __init__(self, *message: Any):
Expand Down
8 changes: 1 addition & 7 deletions qiskit_ibm_provider/visualization/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,7 @@

"""Exceptions related to the visualization modules."""

from ..exceptions import IBMError


class VisualizationError(IBMError):
"""Base class for errors raised by the visualization modules."""

pass
from qiskit.visualization.exceptions import VisualizationError


class VisualizationValueError(VisualizationError, ValueError):
Expand Down
7 changes: 4 additions & 3 deletions test/unit/mock/fake_account_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from typing import List, Dict, Any, Optional

from qiskit.providers.fake_provider.backends.lima.fake_lima import FakeLima
from qiskit.providers.exceptions import QiskitBackendNotFoundError


class FakeApiBackend:
Expand Down Expand Up @@ -81,7 +82,7 @@ def backend_status(self, backend_name: str) -> Dict[str, Any]:
for back in self._backends:
if back.name == backend_name:
return back.status.copy()
raise ValueError(f"Backend {backend_name} not found")
raise QiskitBackendNotFoundError(f"Backend {backend_name} not found")

def backend_properties(
self, backend_name: str, datetime: Optional[python_datetime] = None
Expand All @@ -91,14 +92,14 @@ def backend_properties(
for back in self._backends:
if back.name == backend_name:
return back.properties.copy()
raise ValueError(f"Backend {backend_name} not found")
raise QiskitBackendNotFoundError(f"Backend {backend_name} not found")

def backend_pulse_defaults(self, backend_name: str) -> Dict:
"""Return the pulse defaults of the backend."""
for back in self._backends:
if back.name == backend_name:
return back.defaults.copy()
raise ValueError(f"Backend {backend_name} not found")
raise QiskitBackendNotFoundError(f"Backend {backend_name} not found")

# Test-only methods.

Expand Down
Loading