sqlite: provide better message error for insert
Github-ref: https://github.com/OfflineIMAP/offlineimap/issues/488 Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
parent
df7dd3e3b7
commit
6079755b20
@ -352,8 +352,14 @@ class LocalStatusSQLiteFolder(BaseFolder):
|
|||||||
self.messagelist[uid] = {'uid': uid, 'flags': flags, 'time': rtime, 'mtime': mtime, 'labels': labels}
|
self.messagelist[uid] = {'uid': uid, 'flags': flags, 'time': rtime, 'mtime': mtime, 'labels': labels}
|
||||||
flags = ''.join(sorted(flags))
|
flags = ''.join(sorted(flags))
|
||||||
labels = ', '.join(sorted(labels))
|
labels = ', '.join(sorted(labels))
|
||||||
|
try:
|
||||||
self.__sql_write('INSERT INTO status (id,flags,mtime,labels) VALUES (?,?,?,?)',
|
self.__sql_write('INSERT INTO status (id,flags,mtime,labels) VALUES (?,?,?,?)',
|
||||||
(uid,flags,mtime,labels))
|
(uid,flags,mtime,labels))
|
||||||
|
except Exception as e:
|
||||||
|
six.reraise(UserWarning,
|
||||||
|
UserWarning("%s while inserting UID %s"%
|
||||||
|
(str(e), str(uid))),
|
||||||
|
exc_info()[2])
|
||||||
return uid
|
return uid
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user