Skip to content

Commit 7298be8

Browse files
orvizferag
authored andcommitted
Fix in module import
1 parent 4378a73 commit 7298be8

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

fair_eva/api/rda.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def wrapper(body, **kwargs):
5353

5454
# Load the plugin module
5555
plugin_import_error = True
56-
plugin_import_error_exception = ""
56+
plugin_error_message = ""
5757
plugin_list = collect_plugins()
5858
if plugin_name in plugin_list:
5959
try:
@@ -63,14 +63,13 @@ def wrapper(body, **kwargs):
6363
f"Successfully imported plugin module from {PLUGIN_PATH}.{plugin_name}.plugin"
6464
)
6565
except ImportError as e:
66-
plugin_import_error_exception = str(e)
66+
plugin_error_message = f"Could not import plugin <{plugin_name}>!: {e}"
67+
else:
68+
plugin_error_message = f"Could not find plugin module <{plugin_name}>! Current list of plugins available in '{PLUGIN_PATH}' namespace: {plugin_list}"
6769
if plugin_import_error:
68-
logger.warning(
69-
f"Could not import plugin <{plugin_name}>! Current list of plugins available in '{PLUGIN_PATH}' namespace: {plugin_list}"
70-
)
71-
if plugin_import_error_exception:
72-
logger.debug(str(plugin_import_error_exception))
73-
return str(plugin_import_error_exception), 400
70+
logger.error(plugin_error_message)
71+
return plugin_error_message, 400
72+
7473
downstream_logger = plugin_module.logger
7574

7675
# Get the identifiers through a search query

0 commit comments

Comments
 (0)