mirror of
https://github.com/beetbox/beets.git
synced 2025-12-17 22:23:16 +01:00
adding AccessFileError as new class error excpetion
This commit is contained in:
parent
11e3a5a923
commit
3fd04ad642
1 changed files with 9 additions and 2 deletions
|
|
@ -32,6 +32,10 @@ from beets.dbcore import types
|
|||
from .query import MatchQuery, NullSort, TrueQuery
|
||||
import six
|
||||
|
||||
class AccessFileError(Exception):
|
||||
"""UI exception. Commands should throw this in order to display
|
||||
nonrecoverable errors to the user.
|
||||
"""
|
||||
|
||||
class FormattedMapping(collections.Mapping):
|
||||
"""A `dict`-like formatted view of a model.
|
||||
|
|
@ -680,8 +684,11 @@ class Transaction(object):
|
|||
"""Execute an SQL statement with substitution values and return
|
||||
the row ID of the last affected row.
|
||||
"""
|
||||
cursor = self.db._connection().execute(statement, subvals)
|
||||
return cursor.lastrowid
|
||||
|
||||
cursor = self.db._connection().execute(statement, subvals)
|
||||
raise AccessFileError("unable to open database file. It might be a permissions problem")
|
||||
return cursor.lastrowid
|
||||
|
||||
|
||||
def script(self, statements):
|
||||
"""Execute a string containing multiple SQL statements."""
|
||||
|
|
|
|||
Loading…
Reference in a new issue