From b665d6d0deb2dde7521c8e038bc7233d1a32d023 Mon Sep 17 00:00:00 2001 From: Arian Sanusi Date: Thu, 13 Jan 2022 00:15:09 +0100 Subject: [PATCH 1/3] on plugin loading also catch pkg_resources.DistributionNotFound --- pylsp/config/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pylsp/config/config.py b/pylsp/config/config.py index 053dd236..358d8016 100644 --- a/pylsp/config/config.py +++ b/pylsp/config/config.py @@ -50,7 +50,7 @@ def __init__(self, root_uri, init_opts, process_id, capabilities): for entry_point in pkg_resources.iter_entry_points(PYLSP): try: entry_point.load() - except ImportError as e: + except (ImportError, pkg_resources.DistributionNotFound) as e: log.warning("Failed to load %s entry point '%s': %s", PYLSP, entry_point.name, e) self._pm.set_blocked(entry_point.name) From b4ae508599a95e224a16b7646d0fc581c8d689a3 Mon Sep 17 00:00:00 2001 From: arian-f <48122976+arian-f@users.noreply.github.com> Date: Mon, 31 Jan 2022 16:43:26 +0100 Subject: [PATCH 2/3] Update pylsp/config/config.py catch all exceptions to log them instead of specific exceptions. Co-authored-by: Carlos Cordoba --- pylsp/config/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pylsp/config/config.py b/pylsp/config/config.py index 358d8016..ddf37fa4 100644 --- a/pylsp/config/config.py +++ b/pylsp/config/config.py @@ -50,7 +50,7 @@ def __init__(self, root_uri, init_opts, process_id, capabilities): for entry_point in pkg_resources.iter_entry_points(PYLSP): try: entry_point.load() - except (ImportError, pkg_resources.DistributionNotFound) as e: + except Exception as e: log.warning("Failed to load %s entry point '%s': %s", PYLSP, entry_point.name, e) self._pm.set_blocked(entry_point.name) From b7a239cf0c78b40dc7965c1d27e541b769f192ad Mon Sep 17 00:00:00 2001 From: arian-f <48122976+arian-f@users.noreply.github.com> Date: Mon, 31 Jan 2022 16:59:07 +0100 Subject: [PATCH 3/3] hush the linter Co-authored-by: Carlos Cordoba --- pylsp/config/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pylsp/config/config.py b/pylsp/config/config.py index ddf37fa4..498c645a 100644 --- a/pylsp/config/config.py +++ b/pylsp/config/config.py @@ -50,7 +50,7 @@ def __init__(self, root_uri, init_opts, process_id, capabilities): for entry_point in pkg_resources.iter_entry_points(PYLSP): try: entry_point.load() - except Exception as e: + except Exception as e: # pylint: disable=broad-except log.warning("Failed to load %s entry point '%s': %s", PYLSP, entry_point.name, e) self._pm.set_blocked(entry_point.name)