瀏覽代碼

Add error traceback in comment if no message_log

version-14
Nabin Hait 8 年之前
父節點
當前提交
d61123180c
共有 1 個檔案被更改,包括 6 行新增2 行删除
  1. +6
    -2
      frappe/model/document.py

+ 6
- 2
frappe/model/document.py 查看文件

@@ -999,8 +999,12 @@ def execute_action(doctype, name, action, **kwargs):
getattr(doc, action)(**kwargs)
except frappe.ValidationError:
# add a comment (?)
doc.add_comment('Comment',
_('Action Failed') + '<br><br>' + json.loads(frappe.local.message_log[-1]).get('message'))
if frappe.local.message_log:
msg = json.loads(frappe.local.message_log[-1]).get('message')
else:
msg = '<pre><code>' + frappe.get_traceback() + '</pre></code>'
doc.add_comment('Comment', _('Action Failed') + '<br><br>' + msg)

doc.notify_update()
except Exception:


Loading…
取消
儲存