Skip to content

Commit

Permalink
Enhance public interface definitions across modules.
Browse files Browse the repository at this point in the history
  • Loading branch information
hreikin committed Dec 31, 2024
1 parent fc22850 commit fb52882
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 3 deletions.
5 changes: 4 additions & 1 deletion xmrig/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,4 +290,7 @@ def start_miner(self) -> bool:
except requests.exceptions.RequestException as e:
raise XMRigConnectionError(f"A connection error occurred starting the miner: {e}") from e
except Exception as e:
raise XMRigAPIError(f"An error occurred starting the miner: {e}") from e
raise XMRigAPIError(f"An error occurred starting the miner: {e}") from e

# Define the public interface of the module
__all__ = ["XMRigAPI"]
5 changes: 4 additions & 1 deletion xmrig/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,4 +191,7 @@ def delete_all_miner_data_from_db(cls, miner_name: str, db_url: str) -> None:
connection.execute(text(f"DROP TABLE IF EXISTS {summary_table}"))
log.debug(f"All tables for '{miner_name}' have been deleted from the database")
except Exception as e:
raise XMRigDatabaseError(f"An error occurred deleting miner '{miner_name}' from the database: {e}") from e
raise XMRigDatabaseError(f"An error occurred deleting miner '{miner_name}' from the database: {e}") from e

# Define the public interface of the module
__all__ = ["XMRigDatabase"]
5 changes: 4 additions & 1 deletion xmrig/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,4 +118,7 @@ def __init__(self, message: str = "An error occurred retrieving properties from
message (str): Error message. Defaults to a generic properties error message.
"""
self.message = message
super().__init__(self.message)
super().__init__(self.message)

# Define the public interface of the module
__all__ = ["XMRigAPIError", "XMRigAuthorizationError", "XMRigConnectionError", "XMRigDatabaseError", "XMRigManagerError", "XMRigPropertiesError"]
3 changes: 3 additions & 0 deletions xmrig/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,6 @@ def list_miners(self) -> List[str]:
return list(self._miners.keys())
except Exception as e:
raise XMRigManagerError(f"An error occurred listing miners: {e}") from e

# Define the public interface of the module
__all__ = ["XMRigManager"]
3 changes: 3 additions & 0 deletions xmrig/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -2762,3 +2762,6 @@ def conf_pause_on_active_property(self) -> bool:
bool: Pause on active status, or "N/A" if not available.
"""
return self._get_data_from_response(self._config_response, ["pause-on-active"], self._config_table_name)

# Define the public interface of the module
__all__ = ["XMRigProperties"]

0 comments on commit fb52882

Please sign in to comment.