diff --git a/qiskit_ibm_provider/qpy/exceptions.py b/qiskit_ibm_provider/qpy/exceptions.py index 9b23810db..a537ed9a1 100644 --- a/qiskit_ibm_provider/qpy/exceptions.py +++ b/qiskit_ibm_provider/qpy/exceptions.py @@ -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): diff --git a/qiskit_ibm_provider/visualization/exceptions.py b/qiskit_ibm_provider/visualization/exceptions.py index ed1cf8910..627d68f6a 100644 --- a/qiskit_ibm_provider/visualization/exceptions.py +++ b/qiskit_ibm_provider/visualization/exceptions.py @@ -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): diff --git a/test/unit/mock/fake_account_client.py b/test/unit/mock/fake_account_client.py index a21a726d3..8d447e327 100644 --- a/test/unit/mock/fake_account_client.py +++ b/test/unit/mock/fake_account_client.py @@ -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: @@ -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 @@ -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.