Test exception.args before using it for issue734
This commit is contained in:
1 parent
613237fd51
commit
8f7b83e8e7
3 files changed
+9
-6
No files matched your search
+3
-2
@@ -46,9 +46,10 @@ class OSVService(Service):
|
||||
res = getattr(obj, method)(cursor, user, *args, **kargs)
|
||||
return res
|
||||
except Exception, exception:
|
||||
if CONFIG['verbose'] or str(exception.args[0]) not in \
|
||||
if CONFIG['verbose'] or (exception.args \
|
||||
and str(exception.args[0]) not in \
|
||||
('NotLogged', 'ConcurrencyException', 'UserError',
|
||||
'UserWarning'):
|
||||
'UserWarning')):
|
||||
tb_s = reduce(lambda x, y: x+y,
|
||||
traceback.format_exception(*sys.exc_info()))
|
||||
logger = logging.getLogger("web-service")
|
||||
|
||||
@@ -56,9 +56,10 @@ class ReportService(Service):
|
||||
res = report.execute(cursor, user, ids, datas, context)
|
||||
return res
|
||||
except Exception, exception:
|
||||
if CONFIG['verbose'] or str(exception.args[0]) not in \
|
||||
if CONFIG['verbose'] or (exception.args \
|
||||
and str(exception.args[0]) not in \
|
||||
('NotLogged', 'ConcurrencyException', 'UserError',
|
||||
'UserWarning'):
|
||||
'UserWarning')):
|
||||
tb_s = reduce(lambda x, y: x+y,
|
||||
traceback.format_exception(*sys.exc_info()))
|
||||
logging.getLogger("web-service").error(
|
||||
|
||||
@@ -34,9 +34,10 @@ class WizardService(Service):
|
||||
res = wizard.execute(cursor, user, data, state, context)
|
||||
return res
|
||||
except Exception, exception:
|
||||
if CONFIG['verbose'] or str(exception.args[0]) not in \
|
||||
if CONFIG['verbose'] or (exception.args \
|
||||
and str(exception.args[0]) not in \
|
||||
('NotLogged', 'ConcurrencyException', 'UserError',
|
||||
'UserWarning'):
|
||||
'UserWarning')):
|
||||
tb_s = reduce(lambda x, y: x+y,
|
||||
traceback.format_exception(*sys.exc_info()))
|
||||
logging.getLogger("web-service").error(
|
||||
|
||||
Reference in new issue
Block a user