Table counts now handles SQL Logic Error too

I tried running Datasette against 22 database files at once and ran into
a weird error where the table counts broke with an SQL Logic Error
exception. Easy fix: catch that exception too and treat it the same as a
regular Interrupted error.
This commit is contained in:
Simon Willison 2019-05-15 20:55:28 -07:00
commit 2ad9d15cd6

View file

@ -172,7 +172,9 @@ class ConnectedDatabase:
)
).rows[0][0]
counts[table] = table_count
except InterruptedError:
# In some cases I saw "SQL Logic Error" here in addition to
# InterruptedError - so we catch that too:
except (InterruptedError, sqlite3.OperationalError):
counts[table] = None
if not self.is_mutable:
self.cached_table_counts = counts