Handle "out of memory" error in sql.init()
This commit is contained in:
parent
814a88b741
commit
4fed8518e1
@ -72,7 +72,18 @@ class SqliteError(SqlError):
|
||||
'8', # SQLITE_READONLY
|
||||
'13', # SQLITE_FULL
|
||||
]
|
||||
self.environmental = error.nativeErrorCode() in environmental_errors
|
||||
# At least in init(), we can get errors like this:
|
||||
# type: ConnectionError
|
||||
# database text: out of memory
|
||||
# driver text: Error opening database
|
||||
# error code: -1
|
||||
environmental_strings = [
|
||||
"out of memory",
|
||||
]
|
||||
errcode = error.nativeErrorCode()
|
||||
self.environmental = (
|
||||
errcode in environmental_errors or
|
||||
(errcode == -1 and error.databaseText() in environmental_strings))
|
||||
|
||||
def text(self):
|
||||
return self.error.databaseText()
|
||||
|
Loading…
Reference in New Issue
Block a user