Detect corrupted database files

This commit is contained in:
Adrian Sampson 2014-11-28 22:40:11 -08:00
parent e27f778d51
commit 00c8f6ac25
2 changed files with 4 additions and 1 deletions

View file

@ -888,7 +888,9 @@ def _open_library(config):
get_path_formats(),
get_replacements(),
)
except sqlite3.OperationalError:
lib.get_item(0) # Test database connection.
except (sqlite3.OperationalError, sqlite3.DatabaseError):
log.debug(traceback.format_exc())
raise UserError(u"database file {0} could not be opened".format(
util.displayable_path(dbpath)
))

View file

@ -14,6 +14,7 @@ New:
Fixed:
* Fix a new crash with the latest version of Mutagen (1.26).
* We now print a better error message when the database file is corrupted.
.. _Plex: https://plex.tv/