mirror of
https://github.com/beetbox/beets.git
synced 2025-12-18 14:44:28 +01:00
Re-raise other errors
And re-use the SQLite error string instead of a hand-written one for now.
This commit is contained in:
parent
621427fa63
commit
19e09585d8
1 changed files with 6 additions and 2 deletions
|
|
@ -693,10 +693,14 @@ class Transaction(object):
|
|||
cursor = self.db._connection().execute(statement, subvals)
|
||||
return cursor.lastrowid
|
||||
except sqlite3.OperationalError as e:
|
||||
# In two specific cases, SQLite reports an error while accessing
|
||||
# the underlying database file. We surface these exceptions as
|
||||
# DBAccessError so the application can abort.
|
||||
if e.args[0] in ("attempt to write a readonly database",
|
||||
"unable to open database file"):
|
||||
raise DBAccessError('Unable to open database file.'
|
||||
'It might be a permissions problem')
|
||||
raise DBAccessError(e.args[0])
|
||||
else:
|
||||
raise
|
||||
|
||||
def script(self, statements):
|
||||
"""Execute a string containing multiple SQL statements."""
|
||||
|
|
|
|||
Loading…
Reference in a new issue