Skip to content

P2PoolAPIError

Bases: Exception

Exception raised when a general error occurs with the P2Pool API.

Attributes:

Name Type Description
error str

Specific error message.

traceback str

Traceback of the error.

message str

Error message explaining the API issue.

Source code in p2pool/exceptions.py
class P2PoolAPIError(Exception):
    """
    Exception raised when a general error occurs with the P2Pool API.

    Attributes:
        error (str): Specific error message.
        traceback (str): Traceback of the error.
        message (str): Error message explaining the API issue.
    """
    def __init__(self, error = None, traceback = None, message = "An error occurred with the P2Pool API:"):
        """
        Initialize the API error.

        Args:
            error (str, optional): Specific error message. Defaults to None.
            traceback (str, optional): Traceback of the error. Defaults to None.
            message (str): Error message explaining the API issue. Defaults to a generic API error message.
        """
        error_message = f" {error}" if error else ""
        traceback_message = f"\n{traceback}" if traceback else ""
        self.message = message + error_message + traceback_message
        super().__init__(self.message)

__init__(error=None, traceback=None, message='An error occurred with the P2Pool API:')

Initialize the API error.

Parameters:

Name Type Description Default
error str

Specific error message. Defaults to None.

None
traceback str

Traceback of the error. Defaults to None.

None
message str

Error message explaining the API issue. Defaults to a generic API error message.

'An error occurred with the P2Pool API:'
Source code in p2pool/exceptions.py
def __init__(self, error = None, traceback = None, message = "An error occurred with the P2Pool API:"):
    """
    Initialize the API error.

    Args:
        error (str, optional): Specific error message. Defaults to None.
        traceback (str, optional): Traceback of the error. Defaults to None.
        message (str): Error message explaining the API issue. Defaults to a generic API error message.
    """
    error_message = f" {error}" if error else ""
    traceback_message = f"\n{traceback}" if traceback else ""
    self.message = message + error_message + traceback_message
    super().__init__(self.message)