Commit 1bf517b4 authored by Vincent Pelletier's avatar Vincent Pelletier

Store exception information on message in the case where commit fails,...

Store exception information on message in the case where commit fails, removing a possible cause for error messages with no error text.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24077 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1510c060
...@@ -38,6 +38,7 @@ from types import ClassType ...@@ -38,6 +38,7 @@ from types import ClassType
#from time import time #from time import time
from SQLBase import SQLBase from SQLBase import SQLBase
from Products.CMFActivity.ActivityRuntimeEnvironment import setActivityRuntimeValue, updateActivityRuntimeValue, clearActivityRuntimeEnvironment from Products.CMFActivity.ActivityRuntimeEnvironment import setActivityRuntimeValue, updateActivityRuntimeValue, clearActivityRuntimeEnvironment
from zExceptions import ExceptionFormatter
try: try:
from transaction import get as get_transaction from transaction import get as get_transaction
...@@ -491,8 +492,16 @@ class SQLDict(RAMDict, SQLBase): ...@@ -491,8 +492,16 @@ class SQLDict(RAMDict, SQLBase):
except: except:
LOG('SQLDict', PANIC, 'Failed to abort executed messages which also failed to commit. Some objects may be modified accidentally.') LOG('SQLDict', PANIC, 'Failed to abort executed messages which also failed to commit. Some objects may be modified accidentally.')
raise raise
exc_info = sys.exc_info()
exc_type = exc_info[0]
exc_value = str(exc_info[1])
traceback = ''.join(ExceptionFormatter.format_exception(
*exc_info))
for x in message_uid_priority_list: for x in message_uid_priority_list:
x[1].is_executed = MESSAGE_NOT_EXECUTED x[1].is_executed = MESSAGE_NOT_EXECUTED
x[1].exc_type = exc_type
x[1].exc_value = exc_value
x[1].traceback = traceback
failed_message_uid_list = [x[0] for x in message_uid_priority_list] failed_message_uid_list = [x[0] for x in message_uid_priority_list]
try: try:
makeMessageListAvailable(failed_message_uid_list, uid_to_duplicate_uid_list_dict) makeMessageListAvailable(failed_message_uid_list, uid_to_duplicate_uid_list_dict)
......
...@@ -39,6 +39,7 @@ from time import time ...@@ -39,6 +39,7 @@ from time import time
from sets import ImmutableSet from sets import ImmutableSet
from SQLBase import SQLBase from SQLBase import SQLBase
from Products.CMFActivity.ActivityRuntimeEnvironment import setActivityRuntimeValue, updateActivityRuntimeValue, clearActivityRuntimeEnvironment from Products.CMFActivity.ActivityRuntimeEnvironment import setActivityRuntimeValue, updateActivityRuntimeValue, clearActivityRuntimeEnvironment
from zExceptions import ExceptionFormatter
try: try:
from transaction import get as get_transaction from transaction import get as get_transaction
...@@ -320,6 +321,11 @@ class SQLQueue(RAMQueue, SQLBase): ...@@ -320,6 +321,11 @@ class SQLQueue(RAMQueue, SQLBase):
# It is possible that the message is executed but the commit # It is possible that the message is executed but the commit
# of the transaction fails # of the transaction fails
value[1].is_executed = MESSAGE_NOT_EXECUTED value[1].is_executed = MESSAGE_NOT_EXECUTED
exc_info = sys.exc_info()
value[1].exc_type = exc_info[0]
value[1].exc_value = str(exc_info[1])
value[1].traceback = ''.join(ExceptionFormatter.format_exception(
*exc_info))
try: try:
makeMessageListAvailable([value[0]]) makeMessageListAvailable([value[0]])
except: except:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment