Skip to content

Commit

Permalink
Error handling if plugin is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
johanneskoester committed Sep 21, 2023
1 parent 474a9ca commit 2212b3a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion snakemake_interface_common/plugin_registry/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,14 @@ def __init__(self):

def get_plugin(self, plugin_name):
"""Get a plugin by name."""
return self.plugins[plugin_name.replace("-", "_")]
try:
return self.plugins[plugin_name.replace("-", "_")]
except KeyError:
raise InvalidPluginException(
plugin_name,
f"The package {self.module_prefix.replace('_', '-')}-{plugin_name} is "
"not installed.",
)

def register_cli_args(self, argparser):
"""Add arguments derived from self.executor_settings to given
Expand Down

0 comments on commit 2212b3a

Please sign in to comment.