From 46a03a20009f625fa5b2ebbb4f05caf6b3b6f114 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Mon, 1 Jul 2019 13:17:16 +0200 Subject: [PATCH] Log the invalid values when raising errors --- pyrogram/client/storage/memory_storage.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pyrogram/client/storage/memory_storage.py b/pyrogram/client/storage/memory_storage.py index ff4cb540..e69d247f 100644 --- a/pyrogram/client/storage/memory_storage.py +++ b/pyrogram/client/storage/memory_storage.py @@ -130,7 +130,7 @@ class MemoryStorage(Storage): access_hash=access_hash ) - raise ValueError("Invalid peer type") + raise ValueError("Invalid peer type: {}".format(peer_type)) def get_peer_by_id(self, peer_id: int): r = self.conn.execute( @@ -139,7 +139,7 @@ class MemoryStorage(Storage): ).fetchone() if r is None: - raise KeyError("ID not found") + raise KeyError("ID not found: {}".format(peer_id)) return self._get_input_peer(*r) @@ -150,10 +150,10 @@ class MemoryStorage(Storage): ).fetchone() if r is None: - raise KeyError("Username not found") + raise KeyError("Username not found: {}".format(username)) if abs(time.time() - r[3]) > self.USERNAME_TTL: - raise KeyError("Username expired") + raise KeyError("Username expired: {}".format(username)) return self._get_input_peer(*r[:3]) @@ -164,7 +164,7 @@ class MemoryStorage(Storage): ).fetchone() if r is None: - raise KeyError("Phone number not found") + raise KeyError("Phone number not found: {}".format(phone_number)) return self._get_input_peer(*r)