[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
|
return result
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
self.log('exception', tools.exception_to_unicode(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))
|
tb_s = "".join(traceback.format_exception(*tb))
|
||||||
if tools.config['debug_mode']:
|
if tools.config['debug_mode']:
|
||||||
import pdb
|
import pdb
|
||||||
|
|
|
@ -518,6 +518,13 @@ wizard()
|
||||||
# Report state:
|
# Report state:
|
||||||
# False -> True
|
# 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):
|
class report_spool(netsvc.Service):
|
||||||
def __init__(self, name='report'):
|
def __init__(self, name='report'):
|
||||||
netsvc.Service.__init__(self, name)
|
netsvc.Service.__init__(self, name)
|
||||||
|
@ -553,12 +560,12 @@ class report_spool(netsvc.Service):
|
||||||
except Exception, exception:
|
except Exception, exception:
|
||||||
import traceback
|
import traceback
|
||||||
import sys
|
import sys
|
||||||
tb_s = reduce(lambda x, y: x+y, traceback.format_exception(
|
tb = sys.exc_info()
|
||||||
sys.exc_type, sys.exc_value, sys.exc_traceback))
|
tb_s = "".join(traceback.format_exception(*tb))
|
||||||
logger = netsvc.Logger()
|
logger = netsvc.Logger()
|
||||||
logger.notifyChannel('web-services', netsvc.LOG_ERROR,
|
logger.notifyChannel('web-services', netsvc.LOG_ERROR,
|
||||||
'Exception: %s\n%s' % (str(exception), tb_s))
|
'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
|
self._reports[id]['state'] = True
|
||||||
cr.close()
|
cr.close()
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in New Issue