Re-raise error in patch handler

This commit is contained in:
Anand Doshi 2014-06-09 17:53:51 +05:30
parent f330afb90b
commit 2fefadd976

View file

@ -53,9 +53,9 @@ def run_single(patchmodule=None, method=None, methodargs=None, force=False):
def execute_patch(patchmodule, method=None, methodargs=None):
"""execute the patch"""
success = False
block_user(True)
frappe.db.begin()
try:
log('Executing {patch} in {site} ({db})'.format(patch=patchmodule or str(methodargs),
site=frappe.local.site, db=frappe.db.cur_db_name))
@ -68,17 +68,16 @@ def execute_patch(patchmodule, method=None, methodargs=None):
elif method:
method(**methodargs)
frappe.db.commit()
success = True
except Exception, e:
except Exception:
frappe.db.rollback()
tb = frappe.get_traceback()
log(tb)
raise
block_user(False)
if success:
else:
frappe.db.commit()
block_user(False)
log('Success')
return success
return True
def update_patch_log(patchmodule):
"""update patch_file in patch log"""