From e097b45984db82d6bdba99924225ebcae8c25cc1 Mon Sep 17 00:00:00 2001 From: "Teemu R." Date: Sat, 4 Jan 2025 11:06:26 +0100 Subject: [PATCH] Improve exception messages on credential mismatches (#1417) --- kasa/transports/klaptransport.py | 13 ++++++++----- kasa/transports/sslaestransport.py | 5 ++++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/kasa/transports/klaptransport.py b/kasa/transports/klaptransport.py index 8934b2cc..508bba09 100644 --- a/kasa/transports/klaptransport.py +++ b/kasa/transports/klaptransport.py @@ -214,8 +214,8 @@ class KlapTransport(BaseTransport): if default_credentials_seed_auth_hash == server_hash: _LOGGER.debug( - "Server response doesn't match our expected hash on ip %s, " - "but an authentication with %s default credentials matched", + "Device response did not match our expected hash on ip %s," + "but an authentication with %s default credentials worked", self._host, key, ) @@ -235,13 +235,16 @@ class KlapTransport(BaseTransport): if blank_seed_auth_hash == server_hash: _LOGGER.debug( - "Server response doesn't match our expected hash on ip %s, " - "but an authentication with blank credentials matched", + "Device response did not match our expected hash on ip %s, " + "but an authentication with blank credentials worked", self._host, ) return local_seed, remote_seed, self._blank_auth_hash # type: ignore - msg = f"Server response doesn't match our challenge on ip {self._host}" + msg = ( + f"Device response did not match our challenge on ip {self._host}, " + f"check that your e-mail and password (both case-sensitive) are correct. " + ) _LOGGER.debug(msg) raise AuthenticationError(msg) diff --git a/kasa/transports/sslaestransport.py b/kasa/transports/sslaestransport.py index 3ea33145..eb67eda8 100644 --- a/kasa/transports/sslaestransport.py +++ b/kasa/transports/sslaestransport.py @@ -603,7 +603,10 @@ class SslAesTransport(BaseTransport): _LOGGER.debug("Credentials match") return local_nonce, server_nonce, pwd_hash - msg = f"Server response doesn't match our challenge on ip {self._host}" + msg = ( + f"Device response did not match our challenge on ip {self._host}, " + f"check that your e-mail and password (both case-sensitive) are correct. " + ) _LOGGER.debug(msg) raise AuthenticationError(msg)