mirror of
				https://github.com/LonamiWebs/Telethon.git
				synced 2025-11-04 01:47:27 +03:00 
			
		
		
		
	except and propagate TypeNotFoundError during update handling
This commit is contained in:
		
							parent
							
								
									9c7ac3b210
								
							
						
					
					
						commit
						2889bd5bf3
					
				| 
						 | 
					@ -319,6 +319,13 @@ class UpdateMethods:
 | 
				
			||||||
                            await self.disconnect()
 | 
					                            await self.disconnect()
 | 
				
			||||||
                            break
 | 
					                            break
 | 
				
			||||||
                        continue
 | 
					                        continue
 | 
				
			||||||
 | 
					                    except errors.TypeNotFoundError as e:
 | 
				
			||||||
 | 
					                        # User is likely doing weird things with their account or session and Telegram gets confused as to what layer they use
 | 
				
			||||||
 | 
					                        self._log[__name__].warning('Cannot get difference since the account is likely misusing the session: %s', e)
 | 
				
			||||||
 | 
					                        self._message_box.end_difference()
 | 
				
			||||||
 | 
					                        self._updates_error = e
 | 
				
			||||||
 | 
					                        await self.disconnect()
 | 
				
			||||||
 | 
					                        break
 | 
				
			||||||
                    except OSError as e:
 | 
					                    except OSError as e:
 | 
				
			||||||
                        # Network is likely down, but it's unclear for how long.
 | 
					                        # Network is likely down, but it's unclear for how long.
 | 
				
			||||||
                        # If disconnect is called this task will be cancelled along with the sleep.
 | 
					                        # If disconnect is called this task will be cancelled along with the sleep.
 | 
				
			||||||
| 
						 | 
					@ -354,6 +361,19 @@ class UpdateMethods:
 | 
				
			||||||
                            await self.disconnect()
 | 
					                            await self.disconnect()
 | 
				
			||||||
                            break
 | 
					                            break
 | 
				
			||||||
                        continue
 | 
					                        continue
 | 
				
			||||||
 | 
					                    except errors.TypeNotFoundError as e:
 | 
				
			||||||
 | 
					                        self._log[__name__].warning(
 | 
				
			||||||
 | 
					                            'Cannot get difference since the account is likely misusing the session: %s',
 | 
				
			||||||
 | 
					                            get_diff.channel.channel_id, e
 | 
				
			||||||
 | 
					                        )
 | 
				
			||||||
 | 
					                        self._message_box.end_channel_difference(
 | 
				
			||||||
 | 
					                            get_diff,
 | 
				
			||||||
 | 
					                            PrematureEndReason.TEMPORARY_SERVER_ISSUES,
 | 
				
			||||||
 | 
					                            self._mb_entity_cache
 | 
				
			||||||
 | 
					                        )
 | 
				
			||||||
 | 
					                        self._updates_error = e
 | 
				
			||||||
 | 
					                        await self.disconnect()
 | 
				
			||||||
 | 
					                        break
 | 
				
			||||||
                    except (
 | 
					                    except (
 | 
				
			||||||
                        errors.PersistentTimestampOutdatedError,
 | 
					                        errors.PersistentTimestampOutdatedError,
 | 
				
			||||||
                        errors.PersistentTimestampInvalidError,
 | 
					                        errors.PersistentTimestampInvalidError,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user