Skip to content

Commit 46a03a2

Browse files
committed
Log the invalid values when raising errors
1 parent 6c80064 commit 46a03a2

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

pyrogram/client/storage/memory_storage.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def _get_input_peer(peer_id: int, access_hash: int, peer_type: str):
130130
access_hash=access_hash
131131
)
132132

133-
raise ValueError("Invalid peer type")
133+
raise ValueError("Invalid peer type: {}".format(peer_type))
134134

135135
def get_peer_by_id(self, peer_id: int):
136136
r = self.conn.execute(
@@ -139,7 +139,7 @@ def get_peer_by_id(self, peer_id: int):
139139
).fetchone()
140140

141141
if r is None:
142-
raise KeyError("ID not found")
142+
raise KeyError("ID not found: {}".format(peer_id))
143143

144144
return self._get_input_peer(*r)
145145

@@ -150,10 +150,10 @@ def get_peer_by_username(self, username: str):
150150
).fetchone()
151151

152152
if r is None:
153-
raise KeyError("Username not found")
153+
raise KeyError("Username not found: {}".format(username))
154154

155155
if abs(time.time() - r[3]) > self.USERNAME_TTL:
156-
raise KeyError("Username expired")
156+
raise KeyError("Username expired: {}".format(username))
157157

158158
return self._get_input_peer(*r[:3])
159159

@@ -164,7 +164,7 @@ def get_peer_by_phone_number(self, phone_number: str):
164164
).fetchone()
165165

166166
if r is None:
167-
raise KeyError("Phone number not found")
167+
raise KeyError("Phone number not found: {}".format(phone_number))
168168

169169
return self._get_input_peer(*r)
170170

0 commit comments

Comments
 (0)