Skip to content

XMRigAPIError

Bases: Exception

Exception raised when a general error occurs with the XMRig 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 xmrig/exceptions.py
class XMRigAPIError(Exception):
    """
    Exception raised when a general error occurs with the XMRig 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: str = None, traceback: str = None, message: str = "An error occurred with the XMRig API:") -> None:
        """
        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 XMRig 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 XMRig API:'
Source code in xmrig/exceptions.py
def __init__(self, error: str = None, traceback: str = None, message: str = "An error occurred with the XMRig API:") -> None:
    """
    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)