Skip to content

Commit

Permalink
give users a hint when no components are found
Browse files Browse the repository at this point in the history
  • Loading branch information
nerdoc committed Apr 3, 2024
1 parent 4136663 commit 4473d2d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tetra/component_register.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,16 @@ def resolve_component(context, name):
except KeyError:
pass

raise ComponentNotFound(f'Component "{name}" not found.')
# if no method lead to finding a component successfully, give the user a hint
# which components are available.
components = []
for app_name, lib in libraries.items():
if lib:
for lib_name, library in lib.items():
if library.components:
for component_name in library.components:
components.append(f"{app_name}.{lib_name}.{component_name}")

raise ComponentNotFound(
f'Component "{name}" not found. Available components are: {components}'
)

0 comments on commit 4473d2d

Please sign in to comment.