diff --git a/jupyter_server/extension/manager.py b/jupyter_server/extension/manager.py index 111e60d7af..aab4c594f4 100644 --- a/jupyter_server/extension/manager.py +++ b/jupyter_server/extension/manager.py @@ -275,12 +275,17 @@ def from_jpserver_extensions(self, jpserver_extensions): self.add_extension(name, enabled=enabled) def add_extension(self, extension_name, enabled=False): + """Try to add extension to manager, return True if successful. + Otherwise, return False. + """ try: extpkg = ExtensionPackage(name=extension_name, enabled=enabled) self._extensions[extension_name] = extpkg + return True # Raise a warning if the extension cannot be loaded. except Exception as e: self.log.warning(e) + return False def link_extension(self, name, serverapp): linked = self._linked_extensions.get(name, False) @@ -320,4 +325,3 @@ def load_all_extensions(self, serverapp): # order. for name in sorted(self.extensions.keys()): self.load_extension(name, serverapp) -