mirror of
https://github.com/ARM-software/workload-automation.git
synced 2025-01-31 10:11:17 +00:00
Improve error repoting when loading extensions
The error message will now contain the offending extension (either package name or full path to extension file) if a Python error occurs when ExtensionLoader attempts to load it.
This commit is contained in:
parent
c5d3c2bd62
commit
e03686f961
@ -304,8 +304,8 @@ class ExtensionLoader(object):
|
||||
for module in walk_modules(package):
|
||||
self._load_module(module)
|
||||
except ImportError as e:
|
||||
message = 'Problem loading extensions from extra packages: {}'
|
||||
raise LoaderError(message.format(e.message))
|
||||
message = 'Problem loading extensions from package {}: {}'
|
||||
raise LoaderError(message.format(package, e.message))
|
||||
|
||||
def _load_from_paths(self, paths, ignore_paths):
|
||||
self.logger.debug('Loading from paths.')
|
||||
@ -333,6 +333,9 @@ class ExtensionLoader(object):
|
||||
self.logger.warn('Got: {}'.format(e))
|
||||
else:
|
||||
raise LoaderError('Failed to load {}'.format(filepath), sys.exc_info())
|
||||
except Exception as e:
|
||||
message = 'Problem loading extensions from {}: {}'
|
||||
raise LoaderError(message.format(filepath, e))
|
||||
|
||||
def _load_module(self, module): # NOQA pylint: disable=too-many-branches
|
||||
self.logger.debug('Checking module %s', module.__name__)
|
||||
|
Loading…
x
Reference in New Issue
Block a user