Raise ImportError and not ValueError when sqlite3 is missing

Excepting ValueError when creating the SQLiteSession could hide
other errors (e.g. using a newer session file on an older version
of the library). Instead, the original error is raised, as if
sqlite3 was being imported within its __init__ method.
This commit is contained in:
Lonami Exo
2019-02-13 08:51:26 +01:00
parent d25442345e
commit 47d9de98ed
2 changed files with 5 additions and 3 deletions

View File

@@ -202,7 +202,7 @@ class TelegramBaseClient(abc.ABC):
if isinstance(session, str) or session is None:
try:
session = SQLiteSession(session)
except ValueError:
except ImportError:
import warnings
warnings.warn(
'The sqlite3 module is not available under this '