mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-08 21:10:29 +00:00
Add new known errors to the error list
This commit is contained in:
@@ -27,6 +27,12 @@ def _get_class_name(error_code):
|
||||
abs(error_code), 'RPCError' + str(error_code).replace('-', 'Neg')
|
||||
)
|
||||
|
||||
if error_code.startswith('2'):
|
||||
error_code = re.sub(r'2', 'TWO_', error_code, count=1)
|
||||
|
||||
if re.match(r'\d+', error_code):
|
||||
raise RuntimeError('error code starting with a digit cannot have valid Python name: {}'.format(error_code))
|
||||
|
||||
return snake_to_camel_case(
|
||||
error_code.replace('FIRSTNAME', 'FIRST_NAME')\
|
||||
.replace('SLOWMODE', 'SLOW_MODE').lower(), suffix='Error')
|
||||
|
Reference in New Issue
Block a user