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:
IluaAir
2026-04-18 19:21:25 +03:00
parent 9fd0ce1516
commit 5fa56d46af
3 changed files with 19 additions and 3 deletions

View File

@@ -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())