Skip to content

Commit 9c535cd

Browse files
committed
Use more specific zigpy exceptions for formation failure
1 parent f93e045 commit 9c535cd

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

zigpy_znp/api.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import zigpy.state
1414
import async_timeout
1515
import zigpy.zdo.types as zdo_t
16+
import zigpy.exceptions
1617
from zigpy.exceptions import NetworkNotFormed
1718

1819
import zigpy_znp
@@ -264,7 +265,7 @@ async def start_network(self):
264265
c.app_config.BDBCommissioningStatus.FormationFailure,
265266
c.app_config.BDBCommissioningStatus.Success,
266267
):
267-
raise RuntimeError(
268+
raise zigpy.exceptions.FormationFailure(
268269
f"Network formation failed: {commissioning_rsp}"
269270
)
270271
else:
@@ -283,7 +284,7 @@ async def start_network(self):
283284
async with async_timeout.timeout(STARTUP_TIMEOUT):
284285
await started_as_coordinator
285286
except asyncio.TimeoutError as e:
286-
raise RuntimeError(
287+
raise zigpy.exceptions.FormationFailure(
287288
"Network formation refused: there is too much RF interference."
288289
" Make sure your coordinator is on a USB 2.0 extension cable and"
289290
" away from any sources of interference, like USB 3.0 ports, SSDs,"

0 commit comments

Comments
 (0)