show first instead of last traceback on multiple errors
on initialization, the error message are collected and shown before starting the server together with the traceback of the last error. This should be the traceback of the first error instead. Change-Id: I86d4b42f7d4f98f2ab3b692cd6548e62acffa11b Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/27011 Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de> Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de> Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
parent
3140d454ae
commit
41489a4a24
@ -228,7 +228,7 @@ class Server:
|
||||
if opts:
|
||||
errors.append(self.unknown_options(cls, opts))
|
||||
self.modules = OrderedDict()
|
||||
failure_traceback = None # traceback for the last error
|
||||
failure_traceback = None # traceback for the first error
|
||||
failed = set() # python modules failed to load
|
||||
self.lastError = None
|
||||
for modname, options in self.module_cfg.items():
|
||||
@ -245,7 +245,8 @@ class Server:
|
||||
errors.append('%s not found' % classname)
|
||||
else:
|
||||
failed.add(pymodule)
|
||||
failure_traceback = traceback.format_exc()
|
||||
if failure_traceback is None:
|
||||
failure_traceback = traceback.format_exc()
|
||||
errors.append('error importing %s' % classname)
|
||||
else:
|
||||
try:
|
||||
@ -259,7 +260,8 @@ class Server:
|
||||
for errtxt in e.args[0] if isinstance(e.args[0], list) else [e.args[0]]:
|
||||
errors.append(' ' + errtxt)
|
||||
except Exception:
|
||||
failure_traceback = traceback.format_exc()
|
||||
if failure_traceback is None:
|
||||
failure_traceback = traceback.format_exc()
|
||||
errors.append('error creating %s' % modname)
|
||||
|
||||
poll_table = dict()
|
||||
@ -288,7 +290,8 @@ class Server:
|
||||
try:
|
||||
modobj.initModule()
|
||||
except Exception as e:
|
||||
failure_traceback = traceback.format_exc()
|
||||
if failure_traceback is None:
|
||||
failure_traceback = traceback.format_exc()
|
||||
errors.append('error initializing %s: %r' % (modname, e))
|
||||
|
||||
if errors:
|
||||
|
Loading…
x
Reference in New Issue
Block a user