Skip to content

Commit 736ddb3

Browse files
committed
Update network-register_node fault handling
1 parent 9e07186 commit 736ddb3

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

plugwise_usb/network/registry.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
from ..api import NodeType
1111
from ..constants import UTF8
12-
from ..exceptions import CacheError, NodeError
12+
from ..exceptions import CacheError, MessageError, NodeError
1313
from ..helpers.util import validate_mac
1414
from ..messages.requests import (
1515
CirclePlusScanRequest,
@@ -249,9 +249,11 @@ async def register_node(self, mac: str) -> int:
249249
raise NodeError(f"MAC '{mac}' invalid")
250250

251251
request = NodeAddRequest(self._send_to_controller, bytes(mac, UTF8), True)
252-
await request.send()
253-
# if response is None or response.ack_id != StickResponseType.ACCEPT:
254-
# raise NodeError(f"Failed to register node {mac}")
252+
try:
253+
await request.send()
254+
except MessageError as exc:
255+
raise MessageError(f"Failed to register Node with {mac}") from exc
256+
255257
self.update_network_registration(self._first_free_address, mac, None)
256258
self._first_free_address += 1
257259
return self._first_free_address - 1

0 commit comments

Comments
 (0)