-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OperationalError from SQlite that indicates a permissions problem. #2508
Changes from 4 commits
11e3a5a
3fd04ad
bccfcb6
cb2f47d
cf744eb
f7a5844
0492741
e756f98
621427f
19e0958
906bd97
7eaaa99
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,6 +32,10 @@ | |
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. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like the description for UserError? Here's an alternative docstring:
|
||
""" | ||
|
||
class FormattedMapping(collections.Mapping): | ||
"""A `dict`-like formatted view of a model. | ||
|
@@ -680,9 +684,12 @@ def mutate(self, statement, subvals=()): | |
"""Execute an SQL statement with substitution values and return | ||
the row ID of the last affected row. | ||
""" | ||
|
||
cursor = self.db._connection().execute(statement, subvals) | ||
raise AccessFileError("unable to open database file. It might be a permissions problem") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably be in an exception handler for OperationalError. |
||
return cursor.lastrowid | ||
|
||
|
||
def script(self, statements): | ||
"""Execute a string containing multiple SQL statements.""" | ||
self.db._connection().executescript(statements) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about "DBAccessError" for clarity?