MCPcopy
hub / github.com/beetbox/beets / maybe_handle_plugin_error

Function maybe_handle_plugin_error

beets/metadata_plugins.py:63–74  ·  view source on GitHub ↗

Safely call a plugin method, catching and logging exceptions.

(plugin: MetadataSourcePlugin, method_name: str)

Source from the content-addressed store, hash-verified

61
62@contextmanager
63def maybe_handle_plugin_error(plugin: MetadataSourcePlugin, method_name: str):
64 """Safely call a plugin method, catching and logging exceptions."""
65 if config["raise_on_error"]:
66 yield
67 else:
68 try:
69 yield
70 except Exception as e:
71 log.error(
72 "Error in '{}.{}': {}", plugin.data_source, method_name, e
73 )
74 log.debug("Exception details:", exc_info=True)
75
76
77def _yield_from_plugins(

Callers 3

wrapperFunction · 0.85
album_for_idFunction · 0.85
track_for_idFunction · 0.85

Calls 2

errorMethod · 0.80
debugMethod · 0.45

Tested by

no test coverage detected