qpandalite.exceptions module#

Custom exceptions for QPanda-lite.

This module defines all custom exceptions used throughout the QPanda-lite package, providing clear error types for different failure scenarios.

exception qpandalite.exceptions.AuthenticationError(message, *, details=None)[源代码]

基类:QPandaLiteError

Raised when authentication fails (invalid token, expired credentials, etc.).

This error indicates that the provided API token or credentials are invalid, expired, or do not have the required permissions.

参数:
  • message (str)

  • details (dict | None)

返回类型:

None

exception qpandalite.exceptions.BackendError(message, *, details=None)[源代码]

基类:QPandaLiteError

Raised when a backend operation fails.

This is the base class for all backend-related errors.

参数:
  • message (str)

  • details (dict | None)

返回类型:

None

exception qpandalite.exceptions.BackendNotAvailableError(message, *, details=None)[源代码]

基类:BackendError

Raised when a backend is not available.

This error indicates that the backend is offline, not configured, or cannot be accessed due to missing dependencies.

参数:
  • message (str)

  • details (dict | None)

返回类型:

None

exception qpandalite.exceptions.BackendNotFoundError(message, *, details=None)[源代码]

基类:BackendError

Raised when a requested backend is not found.

This error indicates that the specified backend name is not registered in the backend registry.

参数:
  • message (str)

  • details (dict | None)

返回类型:

None

exception qpandalite.exceptions.CircuitError(message, *, details=None)[源代码]

基类:QPandaLiteError

Raised when a circuit operation fails.

This is the base class for all circuit-related errors.

参数:
  • message (str)

  • details (dict | None)

返回类型:

None

exception qpandalite.exceptions.CircuitTranslationError(message, *, source_format=None, target_format=None, details=None)[源代码]

基类:CircuitError

Raised when circuit translation fails.

This error indicates that a circuit could not be converted from OriginIR to the target backend's native format.

参数:
  • message (str)

  • source_format (str | None)

  • target_format (str | None)

  • details (dict | None)

返回类型:

None

exception qpandalite.exceptions.InsufficientCreditsError(message, *, details=None)[源代码]

基类:QPandaLiteError

Raised when the account has insufficient credits to run a task.

This error indicates that the user's account balance is too low to execute the requested quantum computation.

参数:
  • message (str)

  • details (dict | None)

返回类型:

None

exception qpandalite.exceptions.NetworkError(message, *, url=None, status_code=None, details=None)[源代码]

基类:QPandaLiteError

Raised when a network operation fails.

This error covers connection failures, timeouts, DNS errors, and other network-related issues when communicating with quantum computing backends.

参数:
  • message (str)

  • url (str | None)

  • status_code (int | None)

  • details (dict | None)

返回类型:

None

exception qpandalite.exceptions.QPandaLiteError(message, *, details=None)[源代码]

基类:Exception

Base exception for all QPanda-lite errors.

参数:
  • message (str)

  • details (dict | None)

返回类型:

None

exception qpandalite.exceptions.QuotaExceededError(message, *, details=None)[源代码]

基类:QPandaLiteError

Raised when the user has exceeded their usage quota.

This error indicates that the user has reached their daily, monthly, or total usage limit for the quantum computing service.

参数:
  • message (str)

  • details (dict | None)

返回类型:

None

exception qpandalite.exceptions.TaskFailedError(message, *, task_id=None, backend=None, error_code=None, details=None)[源代码]

基类:QPandaLiteError

Raised when a quantum task fails on the backend.

This error indicates that the task was submitted successfully but failed during execution on the quantum computer or simulator.

参数:
  • message (str)

  • task_id (str | None)

  • backend (str | None)

  • error_code (str | None)

  • details (dict | None)

返回类型:

None

exception qpandalite.exceptions.TaskNotFoundError(message, *, task_id=None, details=None)[源代码]

基类:QPandaLiteError

Raised when a task cannot be found.

This error indicates that the specified task ID does not exist or the user does not have permission to access it.

参数:
  • message (str)

  • task_id (str | None)

  • details (dict | None)

返回类型:

None

exception qpandalite.exceptions.TaskTimeoutError(message, *, task_id=None, timeout=None, details=None)[源代码]

基类:QPandaLiteError

Raised when waiting for a task result exceeds the timeout.

This error indicates that the task did not complete within the specified timeout period. The task may still be running.

参数:
  • message (str)

  • task_id (str | None)

  • timeout (float | None)

  • details (dict | None)

返回类型:

None

exception qpandalite.exceptions.UnsupportedGateError(message, *, gate_name=None, backend=None, details=None)[源代码]

基类:CircuitError

Raised when a circuit contains an unsupported gate.

This error indicates that the target backend does not support one or more gates present in the circuit.

参数:
  • message (str)

  • gate_name (str | None)

  • backend (str | None)

  • details (dict | None)

返回类型:

None