Source code for qiskit_ibm_experiment.exceptions
# This code is part of Qiskit.
#
# (C) Copyright IBM 2021.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.
"""Exceptions related to the IBM Runtime service."""
from qiskit.exceptions import QiskitError
class IBMError(QiskitError):
"""Base class for errors raised by the runtime service modules."""
pass
class IBMAccountError(IBMError):
"""Account related errors."""
pass
class IBMBackendApiProtocolError(IBMError):
"""Errors raised when an unexpected value is received from the server."""
pass
class IBMInputValueError(IBMError):
"""Error raised due to invalid input value."""
pass
class IBMNotAuthorizedError(IBMError):
"""Error raised when a service is invoked from an unauthorized account."""
pass
class IBMApiError(IBMError):
"""Error raised when a server error encountered."""
pass
class IBMProviderMissing(IBMError):
"""Error raised when provider is not passed when creating new experiment"""
pass
[docs]
class IBMExperimentError(IBMError):
"""Base class for errors raised by the experiment service modules."""
pass
[docs]
class IBMExperimentEntryNotFound(IBMExperimentError):
"""Errors raised when an experiment entry cannot be found."""
[docs]
class IBMExperimentEntryExists(IBMExperimentError):
"""Errors raised when an experiment entry already exists."""
class ApiError(IBMError):
"""Generic IBM Quantum API error."""
pass
class RequestsApiError(ApiError):
"""Exception re-raising a RequestException."""
def __init__(self, message: str, status_code: int = -1):
"""RequestsApiError constructor.
Args:
message: Exception message.
status_code: Response status code. -1 for unknown status code.
"""
super().__init__(message)
self.status_code = status_code
class WebsocketError(ApiError):
"""Exceptions related to websockets."""
pass
class WebsocketIBMProtocolError(WebsocketError):
"""Exceptions related to IBM Quantum protocol error."""
pass
class WebsocketAuthenticationError(WebsocketError):
"""Exception caused during websocket authentication."""
pass
class WebsocketTimeoutError(WebsocketError):
"""Timeout during websocket communication."""
pass
class WebsocketRetryableError(WebsocketError):
"""A websocket error that can be retried."""
pass
class AuthenticationLicenseError(ApiError):
"""Exception due to user not having accepted the license agreement."""
pass
class ApiIBMProtocolError(ApiError):
"""Exception related to IBM Quantum API protocol error."""
pass
class UserTimeoutExceededError(ApiError):
"""Exceptions related to exceeding user defined timeout."""
pass