kopia lustrzana https://github.com/OpenDroneMap/WebODM
Fix error shadowing in log when plugin fails to load
I didn't find a standard way of unwrapping the error, short of printing an entire stack trace. I don't think printing a stack trace in a log is useful, so I decided to print the error.__cause__ explicitly. Since there is always one single level of nesting in this code, I think that's OK. See https://docs.python.org/3/library/exceptions.htmlpull/1467/head
rodzic
a1331d0b0b
commit
7c9b1da92a
|
@ -210,9 +210,12 @@ def get_plugins():
|
|||
module = importlib.import_module("plugins.{}".format(dir))
|
||||
|
||||
plugin = (getattr(module, "Plugin"))()
|
||||
except (ImportError, AttributeError):
|
||||
module = importlib.import_module("coreplugins.{}".format(dir))
|
||||
plugin = (getattr(module, "Plugin"))()
|
||||
except (ImportError, AttributeError) as plugin_error:
|
||||
try:
|
||||
module = importlib.import_module("coreplugins.{}".format(dir))
|
||||
plugin = (getattr(module, "Plugin"))()
|
||||
except (ImportError, AttributeError) as coreplugin_error:
|
||||
raise coreplugin_error from plugin_error
|
||||
|
||||
# Check version
|
||||
manifest = plugin.get_manifest()
|
||||
|
@ -237,7 +240,7 @@ def get_plugins():
|
|||
|
||||
plugins.append(plugin)
|
||||
except Exception as e:
|
||||
logger.warning("Failed to instantiate plugin {}: {}".format(dir, e))
|
||||
logger.warning("Failed to instantiate plugin {}: {}: {}".format(dir, e, e.__cause__))
|
||||
|
||||
return plugins
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue