pyasic
Whatsminer Error Codes
A Dataclass to handle error codes of Whatsminers.
Attributes:
Name | Type | Description |
---|---|---|
error_code |
int
|
The error code as an int. |
error_message |
The error message as a string. Automatically found from the error code. |
Source code in pyasic/data/error_codes/whatsminer.py
@dataclass
class WhatsminerError:
"""A Dataclass to handle error codes of Whatsminers.
Attributes:
error_code: The error code as an int.
error_message: The error message as a string. Automatically found from the error code.
"""
error_code: int
error_message: str = field(init=False)
@classmethod
def fields(cls):
return fields(cls)
@property
def error_message(self): # noqa - Skip PyCharm inspection
if len(str(self.error_code)) == 6 and not str(self.error_code)[:1] == "1":
err_type = int(str(self.error_code)[:2])
err_subtype = int(str(self.error_code)[2:3])
err_value = int(str(self.error_code)[3:])
else:
err_type = int(str(self.error_code)[:-2])
err_subtype = int(str(self.error_code)[-2:-1])
err_value = int(str(self.error_code)[-1:])
try:
select_err_type = ERROR_CODES[err_type]
if err_subtype in select_err_type:
select_err_subtype = select_err_type[err_subtype]
if err_value in select_err_subtype:
return select_err_subtype[err_value]
elif "n" in select_err_subtype:
return select_err_subtype[
"n" # noqa: picks up `select_err_subtype["n"]` as not being numeric?
].replace("{n}", str(err_value))
else:
return "Unknown error type."
elif "n" in select_err_type:
select_err_subtype = select_err_type[
"n" # noqa: picks up `select_err_subtype["n"]` as not being numeric?
]
if err_value in select_err_subtype:
return select_err_subtype[err_value]
elif "c" in select_err_subtype:
return (
select_err_subtype["c"]
.replace( # noqa: picks up `select_err_subtype["n"]` as not being numeric?
"{n}", str(err_subtype)
)
.replace("{c}", str(err_value))
)
else:
return "Unknown error type."
except KeyError:
return "Unknown error type."
@error_message.setter
def error_message(self, val):
pass
def asdict(self):
return asdict(self)
Braiins OS Error Codes
A Dataclass to handle error codes of BraiinsOS+ miners.
Attributes:
Name | Type | Description |
---|---|---|
error_message |
str
|
The error message as a string. |
error_code |
int
|
The error code as an int. 0 if the message is not assigned a code. |
Source code in pyasic/data/error_codes/bos.py
@dataclass
class BraiinsOSError:
"""A Dataclass to handle error codes of BraiinsOS+ miners.
Attributes:
error_message: The error message as a string.
error_code: The error code as an int. 0 if the message is not assigned a code.
"""
error_message: str
error_code: int = 0
@classmethod
def fields(cls):
return fields(cls)
def asdict(self):
return asdict(self)
X19 Error Codes
A Dataclass to handle error codes of X19 miners.
Attributes:
Name | Type | Description |
---|---|---|
error_message |
str
|
The error message as a string. |
error_code |
int
|
The error code as an int. 0 if the message is not assigned a code. |
Source code in pyasic/data/error_codes/X19.py
@dataclass
class X19Error:
"""A Dataclass to handle error codes of X19 miners.
Attributes:
error_message: The error message as a string.
error_code: The error code as an int. 0 if the message is not assigned a code.
"""
error_message: str
error_code: int = 0
@classmethod
def fields(cls):
return fields(cls)
def asdict(self):
return asdict(self)
Innosilicon Error Codes
A Dataclass to handle error codes of Innosilicon miners.
Attributes:
Name | Type | Description |
---|---|---|
error_code |
int
|
The error code as an int. |
error_message |
The error message as a string. Automatically found from the error code. |
Source code in pyasic/data/error_codes/innosilicon.py
@dataclass
class InnosiliconError:
"""A Dataclass to handle error codes of Innosilicon miners.
Attributes:
error_code: The error code as an int.
error_message: The error message as a string. Automatically found from the error code.
"""
error_code: int
error_message: str = field(init=False)
@classmethod
def fields(cls):
return fields(cls)
@property
def error_message(self): # noqa - Skip PyCharm inspection
if self.error_code in ERROR_CODES:
return ERROR_CODES[self.error_code]
return "Unknown error type."
@error_message.setter
def error_message(self, val):
pass
def asdict(self):
return asdict(self)