From 1b5d0ca0e5e76e389c51e02af38866690947a120 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Haa=C3=9F?= Date: Wed, 15 Aug 2018 23:24:26 +0200 Subject: [PATCH 1/3] Improve error messages in case of sqlite errors --- beets/ui/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index af2b79a19..8345e40f0 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -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} could not be opened, reason: {1}".format( + util.displayable_path(dbpath), + db_error )) log.debug(u'library database: {0}\n' u'library directory: {1}', From 9f6f1987ab6d201ba447e8ef91ed6b0da6d4bc5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Haa=C3=9F?= Date: Thu, 16 Aug 2018 00:18:26 +0200 Subject: [PATCH 2/3] CodeReview: change message, add changelog entry, fix line length for style check --- beets/ui/__init__.py | 2 +- docs/changelog.rst | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/beets/ui/__init__.py b/beets/ui/__init__.py index 8345e40f0..d3c3dafc2 100644 --- a/beets/ui/__init__.py +++ b/beets/ui/__init__.py @@ -1195,7 +1195,7 @@ def _open_library(config): lib.get_item(0) # Test database connection. except (sqlite3.OperationalError, sqlite3.DatabaseError) as db_error: log.debug(u'{}', traceback.format_exc()) - raise UserError(u"database file {0} could not be opened, reason: {1}".format( + raise UserError(u"database file {0} cannot not be opened: {1}".format( util.displayable_path(dbpath), db_error )) diff --git a/docs/changelog.rst b/docs/changelog.rst index 0d4d01535..86f09a476 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -50,6 +50,8 @@ 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 .. _python-itunes: https://github.com/ocelma/python-itunes From e90eb629c96181390cb8547e5757cf78b61a6a1e Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Wed, 15 Aug 2018 15:30:53 -0700 Subject: [PATCH 3/3] Reference bug #3005 --- docs/changelog.rst | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 86f09a476..45d8220fe 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -51,7 +51,8 @@ Fixes: 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 + sqlite error message is attached to the beets message. + :bug:`3005` .. _python-itunes: https://github.com/ocelma/python-itunes