Skip to content

Commit

Permalink
Merge pull request #3005 from vvvrrooomm/master
Browse files Browse the repository at this point in the history
Improve error messages in case of sqlite errors
  • Loading branch information
sampsyo authored Aug 15, 2018
2 parents 890ba85 + e90eb62 commit b79b759
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
7 changes: 4 additions & 3 deletions beets/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1193,10 +1193,11 @@ def _open_library(config):
get_replacements(),
)
lib.get_item(0) # Test database connection.
except (sqlite3.OperationalError, sqlite3.DatabaseError):
except (sqlite3.OperationalError, sqlite3.DatabaseError) as db_error:
log.debug(u'{}', traceback.format_exc())
raise UserError(u"database file {0} could not be opened".format(
util.displayable_path(dbpath)
raise UserError(u"database file {0} cannot not be opened: {1}".format(
util.displayable_path(dbpath),
db_error
))
log.debug(u'library database: {0}\n'
u'library directory: {1}',
Expand Down
3 changes: 3 additions & 0 deletions docs/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ Fixes:
with CORS enabled.
Thanks to :user:`rveachkc`.
:bug:`2979`: :bug:`2980`
* Improve error reporting: during startup if sqlite returns an error the
sqlite error message is attached to the beets message.
:bug:`3005`

.. _python-itunes: https://github.com/ocelma/python-itunes

Expand Down

0 comments on commit b79b759

Please sign in to comment.