Mercurial > libervia-backend
comparison sat/core/sat_main.py @ 4019:7bf7677b893d
core: log a traceback if a plugin can't be loaded
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 23 Mar 2023 15:24:10 +0100 |
parents | f5ba7594cced |
children | 524856bd7b19 |
comparison
equal
deleted
inserted
replaced
4018:86efd854dee1 | 4019:7bf7677b893d |
---|---|
430 log.info("importing plugin: {}".format(plugin_info["name"])) | 430 log.info("importing plugin: {}".format(plugin_info["name"])) |
431 # we instanciate the plugin here | 431 # we instanciate the plugin here |
432 try: | 432 try: |
433 self.plugins[import_name] = getattr(mod, plugin_info["main"])(self) | 433 self.plugins[import_name] = getattr(mod, plugin_info["main"])(self) |
434 except Exception as e: | 434 except Exception as e: |
435 log.warning( | 435 log.exception( |
436 'Error while loading plugin "{name}", ignoring it: {error}'.format( | 436 f"Can't load plugin \"{plugin_info['name']}\", ignoring it: {e}" |
437 name=plugin_info["name"], error=e | |
438 ) | |
439 ) | 437 ) |
440 if optional: | 438 if optional: |
441 return | 439 return |
442 raise ImportError("Error during initiation") | 440 raise ImportError("Error during initiation") |
443 if C.bool(plugin_info.get(C.PI_HANDLER, C.BOOL_FALSE)): | 441 if C.bool(plugin_info.get(C.PI_HANDLER, C.BOOL_FALSE)): |