Skip to content

Commit 32ee964

Browse files
committed
Add fault-handling in registry-register_node()
1 parent 1c60120 commit 32ee964

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

plugwise_usb/network/registry.py

Lines changed: 5 additions & 2 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, NodeError, StickError
1313
from ..helpers.util import validate_mac
1414
from ..messages.requests import (
1515
CirclePlusScanRequest,
@@ -257,7 +257,10 @@ async def register_node(self, mac: str) -> None:
257257
raise NodeError(f"MAC '{mac}' invalid")
258258

259259
request = NodeAddRequest(self._send_to_controller, bytes(mac, UTF8), True)
260-
await request.send()
260+
try:
261+
await request.send()
262+
except StickError as exc:
263+
raise NodeError("{exc}") from exc
261264

262265
async def unregister_node(self, mac: str) -> None:
263266
"""Unregister node from current Plugwise network."""

0 commit comments

Comments
 (0)