8000 Improve exception messages on credential mismatches (#1417) · python-kasa/python-kasa@e097b45 · GitHub
[go: up one dir, main page]

Skip to content

Commit e097b45

Browse files
authored
Improve exception messages on credential mismatches (#1417)
1 parent 0a95a41 commit e097b45

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

kasa/transports/klaptransport.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,8 +214,8 @@ async def perform_handshake1(self) -> tuple[bytes, bytes, bytes]:
214214

215215
if default_credentials_seed_auth_hash == server_hash:
216216
_LOGGER.debug(
217-
"Server response doesn't match our expected hash on ip %s, "
218-
"but an authentication with %s default credentials matched",
217+
"Device response did not match our expected hash on ip %s,"
218+
"but an authentication with %s default credentials worked",
219219
self._host,
220220
key,
221221
)
@@ -235,13 +235,16 @@ async def perform_handshake1(self) -> tuple[bytes, bytes, bytes]:
235235

236236
if blank_seed_auth_hash == server_hash:
237237
_LOGGER.debug(
238-
"Server response doesn't match our expected hash on ip %s, "
239-
"but an authentication with blank credentials matched",
238+
"Device response did not match our expected hash on ip %s, "
239+
"but an authentication with blank credentials worked",
240240
self._host,
241241
)
242242
return local_seed, remote_seed, self._blank_auth_hash # type: ignore
243243

244-
msg = f"Server response doesn't match our challenge on ip {self._host}"
244+
msg = (
245+
f"Device response did not match our challenge on ip {self._host}, "
246+
f"check that your e-mail and password (both case-sensitive) are correct. "
247+
)
245248
_LOGGER.debug(msg)
246249
raise AuthenticationError(msg)
247250

kasa/transports/sslaestransport.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,10 @@ async def perform_handshake1(self) -> tuple[str, str, str] | None:
603603
_LOGGER.debug("Credentials match")
604604
return local_nonce, server_nonce, pwd_hash
605605

606-
msg = f"Server response doesn't match our challenge on ip {self._host}"
606+
msg = (
607+
f"Device response did not match our challenge on ip {self._host}, "
608+
f"check that your e-mail and password (both case-sensitive) are correct. "
609+
)
607610
_LOGGER.debug(msg)
608611

609612
raise AuthenticationError(msg)

0 commit comments

Comments
 (0)
0