[IMP] When a error occur in a report, the good stacktrace is sent to the client
bzr revid: christophe@tinyerp.com-20090115133404-mcmgvua5jqwo4uj7
This commit is contained in:
parent
586a737f6e
commit
8edf442785
|
@ -228,7 +228,10 @@ class OpenERPDispatcher:
|
|||
return result
|
||||
except Exception, e:
|
||||
self.log('exception', tools.exception_to_unicode(e))
|
||||
tb = sys.exc_info()
|
||||
if hasattr(e, 'traceback'):
|
||||
tb = e.traceback
|
||||
else:
|
||||
tb = sys.exc_info()
|
||||
tb_s = "".join(traceback.format_exception(*tb))
|
||||
if tools.config['debug_mode']:
|
||||
import pdb
|
||||
|
|
|
@ -518,6 +518,13 @@ wizard()
|
|||
# Report state:
|
||||
# False -> True
|
||||
#
|
||||
|
||||
class ExceptionWithTraceback(Exception):
|
||||
def __init__(self, msg, tb):
|
||||
self.message = msg
|
||||
self.traceback = tb
|
||||
self.args = (msg, tb)
|
||||
|
||||
class report_spool(netsvc.Service):
|
||||
def __init__(self, name='report'):
|
||||
netsvc.Service.__init__(self, name)
|
||||
|
@ -553,12 +560,12 @@ class report_spool(netsvc.Service):
|
|||
except Exception, exception:
|
||||
import traceback
|
||||
import sys
|
||||
tb_s = reduce(lambda x, y: x+y, traceback.format_exception(
|
||||
sys.exc_type, sys.exc_value, sys.exc_traceback))
|
||||
tb = sys.exc_info()
|
||||
tb_s = "".join(traceback.format_exception(*tb))
|
||||
logger = netsvc.Logger()
|
||||
logger.notifyChannel('web-services', netsvc.LOG_ERROR,
|
||||
'Exception: %s\n%s' % (str(exception), tb_s))
|
||||
self._reports[id]['exception'] = exception
|
||||
self._reports[id]['exception'] = ExceptionWithTraceback(tools.exception_to_unicode(exception), tb)
|
||||
self._reports[id]['state'] = True
|
||||
cr.close()
|
||||
return True
|
||||
|
|
Loading…
Reference in New Issue