Allow transaction errors

This commit is contained in:
shortcutme 2017-01-11 13:13:37 +01:00
parent 4e96ddfb9e
commit 60fc5fb4d3
No known key found for this signature in database
GPG key ID: 9557210F5E536D3D
2 changed files with 9 additions and 4 deletions

View file

@ -157,7 +157,10 @@ class ContentDbPlugin(object):
def setContentFilesOptional(self, site, content_inner_path, content, cur=None):
if not cur:
cur = self
cur.execute("BEGIN")
try:
cur.execute("BEGIN")
except Exception, err:
self.log.warning("Transaction begin error %s %s: %s" % (site, content_inner_path, Debug.formatException(err)))
num = 0
site_id = self.site_ids[site.address]
@ -190,8 +193,10 @@ class ContentDbPlugin(object):
num += 1
if cur == self:
cur.execute("END")
try:
cur.execute("END")
except Exception, err:
self.log.warning("Transaction end error %s %s: %s" % (site, content_inner_path, Debug.formatException(err)))
return num
def setContent(self, site, inner_path, content, size=0):

View file

@ -212,7 +212,7 @@ class ContentManager(object):
# Update the content
self.contents[content_inner_path] = new_content
except Exception, err:
self.log.warning("Content.json parse error: %s" % Debug.formatException(err))
self.log.warning("%s parse error: %s" % (content_inner_path, Debug.formatException(err)))
return [], [] # Content.json parse error
# Add changed files to bad files