Commit c1e019b8 authored by Vincent Pelletier's avatar Vincent Pelletier

Stack dump is different if caused by an exception or by a simple dump, so use...

Stack dump is different if caused by an exception or by a simple dump, so use different formating methods for each one.
Reorder to first log exception before attemping to format it since it might fail: it happens for example when there is an unicode char in exception value and was the reason for commit 22857.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@24100 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent e3f26c7c
...@@ -353,17 +353,21 @@ Exception: %s %s ...@@ -353,17 +353,21 @@ Exception: %s %s
if is_executed != MESSAGE_EXECUTED: if is_executed != MESSAGE_EXECUTED:
if exc_info is None: if exc_info is None:
exc_info = sys.exc_info() exc_info = sys.exc_info()
if extract_stack is not None and exc_info == (None, None, None):
exc_info = (None, None, extract_stack())
if log: if log:
LOG('ActivityTool', WARNING, 'Could not call method %s on object %s. Activity created at:\n%s' % (self.method_id, self.object_path, self.call_traceback), error=exc_info) LOG('ActivityTool', WARNING, 'Could not call method %s on object %s. Activity created at:\n%s' % (self.method_id, self.object_path, self.call_traceback), error=exc_info)
# push the error in ZODB error_log # push the error in ZODB error_log
error_log = getattr(context, 'error_log', None) error_log = getattr(context, 'error_log', None)
if error_log is not None: if error_log is not None:
error_log.raising(exc_info) error_log.raising(exc_info)
if exc_info == (None, None, None):
if format_list is not None:
self.traceback = ''.join(format_list(extract_stack()[:-1]))
else:
self.traceback = ''
else:
self.traceback = ''.join(ExceptionFormatter.format_exception(*exc_info))
self.exc_type = exc_info[0] self.exc_type = exc_info[0]
self.exc_value = str(exc_info[1]) self.exc_value = str(exc_info[1])
self.traceback = ''.join(ExceptionFormatter.format_exception(*exc_info))
def getExecutionState(self): def getExecutionState(self):
return self.is_executed return self.is_executed
......
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