|
|
@@ -5,6 +5,7 @@ from __future__ import unicode_literals |
|
|
|
import sys, os |
|
|
|
import json |
|
|
|
import logging |
|
|
|
import MySQLdb |
|
|
|
|
|
|
|
from werkzeug.wrappers import Request, Response |
|
|
|
from werkzeug.local import LocalManager |
|
|
@@ -70,6 +71,14 @@ def application(request): |
|
|
|
except Exception, e: |
|
|
|
http_status_code = getattr(e, "http_status_code", 500) |
|
|
|
|
|
|
|
if (http_status_code==500 |
|
|
|
and isinstance(e, MySQLdb.OperationalError) |
|
|
|
and e.args[0] in (1205, 1213)): |
|
|
|
# 1205 = lock wait timeout |
|
|
|
# 1213 = deadlock |
|
|
|
# code 409 represents conflict |
|
|
|
http_status_code = 409 |
|
|
|
|
|
|
|
if frappe.local.is_ajax: |
|
|
|
response = frappe.utils.response.report_error(http_status_code) |
|
|
|
else: |
|
|
|