Skip to content

Commit

Permalink
raise if no plugin is available
Browse files Browse the repository at this point in the history
  • Loading branch information
jensens committed Dec 16, 2024
1 parent 6fde0b1 commit d19d56d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/edutap/wallet_google/plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
def get_image_providers() -> list[ImageProvider]:
eps = entry_points(group="edutap.wallet_google.plugins")
plugins = [ep.load() for ep in eps if ep.name == "ImageProvider"]
if not plugins:
raise NotImplementedError("No image provider plug-in found")
for plugin in plugins:
if not isinstance(plugin, ImageProvider):
raise ValueError(f"{plugin} not implements ImageProvider")
Expand All @@ -15,6 +17,8 @@ def get_image_providers() -> list[ImageProvider]:
def get_callback_handlers() -> list[CallbackHandler]:
eps = entry_points(group="edutap.wallet_google.plugins")
plugins = [ep.load() for ep in eps if ep.name == "CallbackHandler"]
if not plugins:
raise NotImplementedError("No callback handler plugin found.")
for plugin in plugins:
if not isinstance(plugin, CallbackHandler):
raise ValueError(f"{plugin} not implements CallbackHandler")
Expand Down

0 comments on commit d19d56d

Please sign in to comment.