kopia lustrzana https://github.com/simonw/datasette
Better handling of corrupted database files
rodzic
d6b6c9171f
commit
16665c9ee6
|
@ -97,7 +97,7 @@ class Database:
|
||||||
else:
|
else:
|
||||||
rows = cursor.fetchall()
|
rows = cursor.fetchall()
|
||||||
truncated = False
|
truncated = False
|
||||||
except sqlite3.OperationalError as e:
|
except (sqlite3.OperationalError, sqlite3.DatabaseError) as e:
|
||||||
if e.args == ("interrupted",):
|
if e.args == ("interrupted",):
|
||||||
raise QueryInterrupted(e, sql, params)
|
raise QueryInterrupted(e, sql, params)
|
||||||
if log_sql_errors:
|
if log_sql_errors:
|
||||||
|
@ -145,7 +145,7 @@ class Database:
|
||||||
counts[table] = table_count
|
counts[table] = table_count
|
||||||
# In some cases I saw "SQL Logic Error" here in addition to
|
# In some cases I saw "SQL Logic Error" here in addition to
|
||||||
# QueryInterrupted - so we catch that too:
|
# QueryInterrupted - so we catch that too:
|
||||||
except (QueryInterrupted, sqlite3.OperationalError):
|
except (QueryInterrupted, sqlite3.OperationalError, sqlite3.DatabaseError):
|
||||||
counts[table] = None
|
counts[table] = None
|
||||||
if not self.is_mutable:
|
if not self.is_mutable:
|
||||||
self.cached_table_counts = counts
|
self.cached_table_counts = counts
|
||||||
|
|
Ładowanie…
Reference in New Issue