Enhance BaseDevice initialization and error handling
- Updated the `BaseDevice` class constructor to accept an optional `name` parameter for better context in error messages. - Improved the `_validate_contract` method to raise an `OxiAPIError` with a descriptive message if the node is not found. - Modified the `_run_ttp` method to include a check for node existence, returning `None` if not found. - Changed the test file name in the `Eltex` model to reflect a more descriptive context for testing node not found scenarios.
This commit is contained in:
@@ -37,7 +37,7 @@ class Eltex(BaseDevice):
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
with open("./test6.txt") as file:
|
||||
with open("./test_not_found.txt") as file:
|
||||
data = file.read()
|
||||
eltex = Eltex(data)
|
||||
print(eltex.parse())
|
||||
|
||||
Reference in New Issue
Block a user