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:
@@ -60,7 +60,7 @@ class NodeConfig:
|
||||
self._device: type[BaseDevice] = device_registry.get(self._model.lower())
|
||||
if self._device is None:
|
||||
raise ValueError(f"Device model '{self._model}' not found in registry")
|
||||
self._parsed_data = self._device(self.text).parse()
|
||||
self._parsed_data = self._device(self.text, name=self._full_name).parse()
|
||||
|
||||
@cached_property
|
||||
def _response(self):
|
||||
|
||||
Reference in New Issue
Block a user