diff --git a/single_ursim_control/plugin_repository.py b/single_ursim_control/plugin_repository.py index 2771bb5..b1379a5 100644 --- a/single_ursim_control/plugin_repository.py +++ b/single_ursim_control/plugin_repository.py @@ -11,6 +11,10 @@ class UnknownPlugin(Exception): pass +class UnknownCommand(Exception): + pass + + class PluginRepository: def __init__(self): @@ -67,7 +71,10 @@ class PluginRepository: return list(self._command_compilers.keys()) def get_compiler(self, command: str) -> AbstractCommandCompiler: - return self._command_compilers[command] + try: + return self._command_compilers[command] + except KeyError: + raise UnknownCommand(f"Could not find compiler for command: {command}! A plugin might be not loaded.") def get_plugin_instance(self, plugin: str) -> AbstractPlugin: return self._loaded_plugins[plugin]