From 56fef9e8359f291c7f7c7b6ec22704a1f9e0654f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=2E=20Fernando=20S=C3=A1nchez?= Date: Sun, 21 Feb 2016 03:00:11 +0100 Subject: [PATCH] --amend --- senpy/extensions.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/senpy/extensions.py b/senpy/extensions.py index a15e883..75d3fe8 100644 --- a/senpy/extensions.py +++ b/senpy/extensions.py @@ -134,7 +134,12 @@ class Senpy(object): self.plugins[plugin_name].is_activated = active def activate_plugin(self, plugin_name, sync=False): - plugin = self.plugins[plugin_name] + try: + plugin = self.plugins[plugin_name] + except KeyError: + raise Error(message="Plugin not found: {}".format(plugin_name), + status=404) + logger.info("Activating plugin: {}".format(plugin.name)) def act(): try: @@ -152,7 +157,11 @@ class Senpy(object): return th def deactivate_plugin(self, plugin_name, sync=False): - plugin = self.plugins[plugin_name] + try: + plugin = self.plugins[plugin_name] + except KeyError: + raise Error(message="Plugin not found: {}".format(plugin_name), + status=404) def deact(): try: