mirror of
https://github.com/simonw/datasette.git
synced 2025-12-10 16:51:24 +01:00
Better handling of corrupted database files
This commit is contained in:
parent
d6b6c9171f
commit
16665c9ee6
1 changed files with 2 additions and 2 deletions
|
|
@ -97,7 +97,7 @@ class Database:
|
|||
else:
|
||||
rows = cursor.fetchall()
|
||||
truncated = False
|
||||
except sqlite3.OperationalError as e:
|
||||
except (sqlite3.OperationalError, sqlite3.DatabaseError) as e:
|
||||
if e.args == ("interrupted",):
|
||||
raise QueryInterrupted(e, sql, params)
|
||||
if log_sql_errors:
|
||||
|
|
@ -145,7 +145,7 @@ class Database:
|
|||
counts[table] = table_count
|
||||
# In some cases I saw "SQL Logic Error" here in addition to
|
||||
# QueryInterrupted - so we catch that too:
|
||||
except (QueryInterrupted, sqlite3.OperationalError):
|
||||
except (QueryInterrupted, sqlite3.OperationalError, sqlite3.DatabaseError):
|
||||
counts[table] = None
|
||||
if not self.is_mutable:
|
||||
self.cached_table_counts = counts
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue