Add error handling for missing plugin in custom_plugin function

This commit is contained in:
Théophile Diot 2024-02-20 16:57:57 +01:00
parent 9eba06fcfd
commit 13b2f888cc
No known key found for this signature in database
GPG key ID: 248FEA4BAE400D06

View file

@ -1284,6 +1284,13 @@ def custom_plugin(plugin: str):
curr_plugin = plug
break
if not plugin_id:
message = f'Plugin "{plugin}" not found'
app.logger.error(message)
if request.method == "GET":
return message, 404
return {"message": f'Plugin "{plugin}" not found'}, 404
# Get USE_<NAME> if exists
# Check if the plugin is used by one service
config = app.config["CONFIG"].get_config(methods=False)