Skip to content

Commit 8dcdf35

Browse files
committed
feat(plugins): manage warnings
1 parent 9ad22ea commit 8dcdf35

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

src/ansys/tools/common/launcher/_plugins.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626
import importlib.metadata
2727
from importlib.metadata import entry_points
2828
from typing import Any
29+
import warnings
30+
31+
from ansys.tools.common.logger import LOGGER
2932

3033
from .interface import FALLBACK_LAUNCH_MODE_NAME, DataclassProtocol, LauncherProtocol
3134

@@ -64,16 +67,20 @@ def get_all_plugins(hide_fallback: bool = True) -> dict[str, dict[str, type[Laun
6467
try:
6568
product_name, launch_mode = entry_point.name.split(".")
6669
except ValueError:
67-
# skip malformed entry point names
70+
message = f"Skipping malformed entry point name: {entry_point.name}"
71+
warnings.warn(message)
72+
LOGGER.warning(message)
6873
continue
6974

7075
if hide_fallback and launch_mode == FALLBACK_LAUNCH_MODE_NAME:
7176
continue
7277

7378
try:
7479
launcher_class = entry_point.load() # type: ignore
75-
except Exception:
76-
# skip broken plugins
80+
except Exception as exception:
81+
message = f"Skipping broken plugin '{entry_point.name}': {exception}"
82+
warnings.warn(message)
83+
LOGGER.warning(message)
7784
continue
7885

7986
res.setdefault(product_name, dict())

0 commit comments

Comments
 (0)