Skip to content

Commit

Permalink
Change error mapping to be case insensitive
Browse files Browse the repository at this point in the history
  • Loading branch information
Lonami committed Jan 29, 2021
1 parent 584e2b3 commit a12b49f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion telethon/errors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ def rpc_message_to_error(rpc_error, request):
:return: the RPCError as a Python exception that represents this error.
"""
# Try to get the error by direct look-up, otherwise regex
cls = rpc_errors_dict.get(rpc_error.error_message, None)
# Case-insensitive, for things like "timeout" which don't conform.
cls = rpc_errors_dict.get(rpc_error.error_message.upper(), None)
if cls:
return cls(request=request)

Expand Down

0 comments on commit a12b49f

Please sign in to comment.