Added proper failing when a plugin is not loaded
This commit is contained in:
parent
413e1e8a20
commit
5ffaa6228b
@ -11,6 +11,10 @@ class UnknownPlugin(Exception):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class UnknownCommand(Exception):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class PluginRepository:
|
class PluginRepository:
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@ -67,7 +71,10 @@ class PluginRepository:
|
|||||||
return list(self._command_compilers.keys())
|
return list(self._command_compilers.keys())
|
||||||
|
|
||||||
def get_compiler(self, command: str) -> AbstractCommandCompiler:
|
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:
|
def get_plugin_instance(self, plugin: str) -> AbstractPlugin:
|
||||||
return self._loaded_plugins[plugin]
|
return self._loaded_plugins[plugin]
|
||||||
|
Loading…
Reference in New Issue
Block a user