[Core] Fix error handling in loading extensions. (#2688)

* fixes 2687

* raise the right exception
This commit is contained in:
Michael H 2019-05-31 15:38:44 -04:00 committed by Kowlin
parent 3ca2a9af28
commit 0e9086ca1f

View File

@ -261,8 +261,8 @@ class RedBase(commands.GroupMixin, commands.bot.BotBase, RPCMixin):
lib.setup(self) lib.setup(self)
except Exception as e: except Exception as e:
self._remove_module_references(lib.__name__) self._remove_module_references(lib.__name__)
self._call_module_finalizers(lib, key) self._call_module_finalizers(lib, name)
raise errors.ExtensionFailed(key, e) from e raise errors.CogLoadError() from e
else: else:
self._BotBase__extensions[name] = lib self._BotBase__extensions[name] = lib