Skip to content

Commit 1e9f237

Browse files
authored
Use KeyError when throwing a missing security material exception (#185)
* Use `KeyError` when throwing a missing security material exception * Update unit test
1 parent ca061f4 commit 1e9f237

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

tests/tools/test_network_backup_restore.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ async def test_nwk_frame_counter_zstack33(make_connected_znp):
320320
znp.network_info, extended_pan_id=t.EUI64.convert("11:22:33:44:55:66:77:88")
321321
)
322322

323-
with pytest.raises(ValueError):
323+
with pytest.raises(KeyError):
324324
await security.read_nwk_frame_counter(znp)
325325

326326
# Writes similarly will fail

zigpy_znp/znp/security.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ async def read_nwk_frame_counter(znp: ZNP, *, ext_pan_id: t.EUI64 = None) -> t.u
106106
global_entry = entry
107107

108108
if global_entry is None:
109-
raise ValueError("No security material entry was found for this network")
109+
raise KeyError("No security material entry was found for this network")
110110

111111
return global_entry.FrameCounter
112112

0 commit comments

Comments
 (0)