mirror of
				https://github.com/LonamiWebs/Telethon.git
				synced 2025-11-04 01:47:27 +03:00 
			
		
		
		
	Fix timeout error not being excepted on Button.click
This commit is contained in:
		
							parent
							
								
									b20dc3b804
								
							
						
					
					
						commit
						5ed7bf7815
					
				| 
						 | 
					@ -108,7 +108,7 @@ class ServerError(RPCError):
 | 
				
			||||||
        self.message = message
 | 
					        self.message = message
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class BotTimeout(RPCError):
 | 
					class TimedOutError(RPCError):
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    Clicking the inline buttons of bots that never (or take to long to)
 | 
					    Clicking the inline buttons of bots that never (or take to long to)
 | 
				
			||||||
    call ``answerCallbackQuery`` will result in this "special" RPCError.
 | 
					    call ``answerCallbackQuery`` will result in this "special" RPCError.
 | 
				
			||||||
| 
						 | 
					@ -121,6 +121,9 @@ class BotTimeout(RPCError):
 | 
				
			||||||
        self.message = message
 | 
					        self.message = message
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					BotTimeout = TimedOutError
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class BadMessageError(Exception):
 | 
					class BadMessageError(Exception):
 | 
				
			||||||
    """Occurs when handling a bad_message_notification."""
 | 
					    """Occurs when handling a bad_message_notification."""
 | 
				
			||||||
    ErrorMessages = {
 | 
					    ErrorMessages = {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,3 +1,3 @@
 | 
				
			||||||
# Versions should comply with PEP440.
 | 
					# Versions should comply with PEP440.
 | 
				
			||||||
# This line is parsed in setup.py:
 | 
					# This line is parsed in setup.py:
 | 
				
			||||||
__version__ = '1.7.4'
 | 
					__version__ = '1.7.5'
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,6 +13,7 @@ KNOWN_BASE_CLASSES = {
 | 
				
			||||||
    406: 'AuthKeyError',
 | 
					    406: 'AuthKeyError',
 | 
				
			||||||
    420: 'FloodError',
 | 
					    420: 'FloodError',
 | 
				
			||||||
    500: 'ServerError',
 | 
					    500: 'ServerError',
 | 
				
			||||||
 | 
					    503: 'TimedOutError'
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,7 +24,7 @@ def _get_class_name(error_code):
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    if isinstance(error_code, int):
 | 
					    if isinstance(error_code, int):
 | 
				
			||||||
        return KNOWN_BASE_CLASSES.get(
 | 
					        return KNOWN_BASE_CLASSES.get(
 | 
				
			||||||
            error_code, 'RPCError' + str(error_code).replace('-', 'Neg')
 | 
					            abs(error_code), 'RPCError' + str(error_code).replace('-', 'Neg')
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    return snake_to_camel_case(
 | 
					    return snake_to_camel_case(
 | 
				
			||||||
| 
						 | 
					@ -38,7 +39,7 @@ class Error:
 | 
				
			||||||
        self.int_code = codes[0]
 | 
					        self.int_code = codes[0]
 | 
				
			||||||
        self.str_code = name
 | 
					        self.str_code = name
 | 
				
			||||||
        self.subclass = _get_class_name(codes[0])
 | 
					        self.subclass = _get_class_name(codes[0])
 | 
				
			||||||
        self.subclass_exists = codes[0] in KNOWN_BASE_CLASSES
 | 
					        self.subclass_exists = abs(codes[0]) in KNOWN_BASE_CLASSES
 | 
				
			||||||
        self.description = description
 | 
					        self.description = description
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.has_captures = '_X' in name
 | 
					        self.has_captures = '_X' in name
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user