Raise exception when an uncaught error is raised

StrategyResolver.load_strategy would fail if any error outside of (ModuleNotFoundError, SyntaxError, ImportError, NameError) is thrown.
This change makes it raise an OperationalException when that happens. This will potentially be beneficial to people who use StrategyResolver.load_strategy outside of the FT directories.
This commit is contained in:
raphael 2021-11-06 10:34:14 -04:00 committed by GitHub
parent d99eaccb5a
commit 76cf68deed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,6 +69,8 @@ class IResolver:
logger.warning(f"Could not import {module_path} due to '{err}'") logger.warning(f"Could not import {module_path} due to '{err}'")
if enum_failed: if enum_failed:
return iter([None]) return iter([None])
except Exception as e:
raise OperationalException(f"Error loading {module_path}: {e}") from e
valid_objects_gen = ( valid_objects_gen = (
(obj, inspect.getsource(module)) for (obj, inspect.getsource(module)) for