mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-02-03 05:04:33 +03:00
Add a more descriptive error when serializing bytes
This commit is contained in:
parent
e427559d4c
commit
3db13ccdd2
|
@ -93,8 +93,11 @@ class TLObject:
|
|||
@staticmethod
|
||||
def serialize_bytes(data):
|
||||
"""Write bytes by using Telegram guidelines"""
|
||||
if isinstance(data, str):
|
||||
data = data.encode('utf-8')
|
||||
if not isinstance(data, bytes):
|
||||
if isinstance(data, str):
|
||||
data = data.encode('utf-8')
|
||||
else:
|
||||
raise ValueError('bytes or str expected, not', type(data))
|
||||
|
||||
r = []
|
||||
if len(data) < 254:
|
||||
|
|
Loading…
Reference in New Issue
Block a user