show traceback of first error instead of last one
Change-Id: Iee418dcfb1d81a16112eed57b03c86242c2128b4
This commit is contained in:
parent
929f55055e
commit
cbb005d942
@ -29,6 +29,7 @@ import threading
|
|||||||
import traceback
|
import traceback
|
||||||
from os import environ, path
|
from os import environ, path
|
||||||
|
|
||||||
|
|
||||||
repodir = path.abspath(path.join(path.dirname(__file__), '..', '..'))
|
repodir = path.abspath(path.join(path.dirname(__file__), '..', '..'))
|
||||||
|
|
||||||
if path.splitext(sys.executable)[1] == ".exe" and not path.basename(sys.executable).startswith('python'):
|
if path.splitext(sys.executable)[1] == ".exe" and not path.basename(sys.executable).startswith('python'):
|
||||||
|
@ -232,7 +232,7 @@ class Server:
|
|||||||
if opts:
|
if opts:
|
||||||
errors.append(self.unknown_options(cls, opts))
|
errors.append(self.unknown_options(cls, opts))
|
||||||
self.modules = OrderedDict()
|
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
|
failed = set() # python modules failed to load
|
||||||
self.lastError = None
|
self.lastError = None
|
||||||
for modname, options in self.module_cfg.items():
|
for modname, options in self.module_cfg.items():
|
||||||
@ -249,6 +249,7 @@ class Server:
|
|||||||
errors.append('%s not found' % classname)
|
errors.append('%s not found' % classname)
|
||||||
else:
|
else:
|
||||||
failed.add(pymodule)
|
failed.add(pymodule)
|
||||||
|
if failure_traceback is None:
|
||||||
failure_traceback = traceback.format_exc()
|
failure_traceback = traceback.format_exc()
|
||||||
errors.append('error importing %s' % classname)
|
errors.append('error importing %s' % classname)
|
||||||
else:
|
else:
|
||||||
@ -263,6 +264,7 @@ class Server:
|
|||||||
for errtxt in e.args[0] if isinstance(e.args[0], list) else [e.args[0]]:
|
for errtxt in e.args[0] if isinstance(e.args[0], list) else [e.args[0]]:
|
||||||
errors.append(' ' + errtxt)
|
errors.append(' ' + errtxt)
|
||||||
except Exception:
|
except Exception:
|
||||||
|
if failure_traceback is None:
|
||||||
failure_traceback = traceback.format_exc()
|
failure_traceback = traceback.format_exc()
|
||||||
errors.append('error creating %s' % modname)
|
errors.append('error creating %s' % modname)
|
||||||
|
|
||||||
@ -292,6 +294,7 @@ class Server:
|
|||||||
try:
|
try:
|
||||||
modobj.initModule()
|
modobj.initModule()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
if failure_traceback is None:
|
||||||
failure_traceback = traceback.format_exc()
|
failure_traceback = traceback.format_exc()
|
||||||
errors.append('error initializing %s: %r' % (modname, e))
|
errors.append('error initializing %s: %r' % (modname, e))
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user