Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

report traceback on plugin loading for certain verbosities #13846

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions conda/plugins/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def register(self, plugin, name: str | None = None) -> str | None:
raise PluginError(
f"Error while loading conda plugin: "
f"{name or self.get_canonical_name(plugin)} ({err})"
)
) from err
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, exception chaining!


def load_plugins(self, *plugins) -> int:
"""
Expand Down Expand Up @@ -142,9 +142,12 @@ def load_entrypoints(self, group: str, name: str | None = None) -> int:
# not using exc_info=True here since the CLI loggers are
# set up after CLI initialization and argument parsing,
# meaning that it comes too late to properly render
# a traceback
# a traceback; instead we pass exc_info conditionally on
# context.verbosity
kwargs = {"exc_info": err} if context.verbosity >= 2 else {}
log.warning(
f"Error while loading conda entry point: {entry_point.name} ({err})"
f"Error while loading conda entry point: {entry_point.name} ({err})",
**kwargs,
)
continue

Expand Down
19 changes: 19 additions & 0 deletions news/13846-debug-plugin-exceptions
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* Report traceback of plugin loading errors with verbosity 2 or higher (`-vv` or more). (#13742 via #13846)

### Bug fixes

* <news item>

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>