From 4eef9b52c9c8073974082ea387c5a7a96e49cde8 Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Fri, 21 Jul 2023 22:56:16 +0200 Subject: [PATCH] Handle sqlite3.OperationalError in update loop --- telethon/client/updates.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/telethon/client/updates.py b/telethon/client/updates.py index a69aaf31..11431e83 100644 --- a/telethon/client/updates.py +++ b/telethon/client/updates.py @@ -9,6 +9,7 @@ import typing import logging import warnings from collections import deque +import sqlite3 from .. import events, utils, errors from ..events.common import EventBuilder, EventCommon @@ -319,7 +320,7 @@ class UpdateMethods: await self.disconnect() break continue - except errors.TypeNotFoundError as e: + except (errors.TypeNotFoundError, sqlite3.OperationalError) 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() @@ -361,7 +362,7 @@ class UpdateMethods: await self.disconnect() break continue - except errors.TypeNotFoundError as e: + except (errors.TypeNotFoundError, sqlite3.OperationalError) as e: self._log[__name__].warning( 'Cannot get difference for channel %s since the account is likely misusing the session: %s', get_diff.channel.channel_id, e