From 2ad9d15cd6901654e6801e2faa29e6fc08bae5fa Mon Sep 17 00:00:00 2001 From: Simon Willison Date: Wed, 15 May 2019 20:55:28 -0700 Subject: [PATCH] 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. --- datasette/app.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/datasette/app.py b/datasette/app.py index db771e40..62a609ae 100644 --- a/datasette/app.py +++ b/datasette/app.py @@ -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