Loading a corrupted database does not raise exception gracefully
If you try to load a file which isn't a database, you get the following error:
Exception in thread Thread-1:
Traceback (most recent call last):
File "...\lib\threading.py", line 916, in _bootstrap_inner
self.run()
File "...\lib\site-packages\sqlitedict.py", line 396, in run
conn.execute('PRAGMA journal_mode = %s' % self.journal_mode)
sqlite3.DatabaseError: file is not a database
The problem here is that the error raises in a thread which then dies and leave your console hanging, probably due to missing multithread error handling.
I find it strange that I should get multithreading when I use SqliteDict and not SqliteMultithread, which I traced to the _new_conn method. A quick fix would be to avoid using multithreading when none is requested in order to avoid this sort of error when not using multithreading at least.
Thanks for reporting @mtanti . Will you be able to look into this, submit a PR?
Thanks for reporting @mtanti . Will you be able to look into this, submit a PR?
No I don't have time, sorry.