diff --git a/src/ui/main.py b/src/ui/main.py index a83c23a78..128c139ae 100755 --- a/src/ui/main.py +++ b/src/ui/main.py @@ -330,6 +330,7 @@ def run_action(plugin: str, function_name: str = ""): if tmp_dir: sys_path.pop() rmtree(tmp_dir, ignore_errors=True) + app.logger.exception("An error occurred while importing the plugin") return {"status": "ko", "code": 500, "message": "An error occurred while importing the plugin, see logs for more details"} @@ -359,6 +360,7 @@ def run_action(plugin: str, function_name: str = ""): sys_path.pop() rmtree(tmp_dir, ignore_errors=True) + app.logger.exception(message) if message or not isinstance(res, dict) and not res: return {"status": "ko", "code": 500, "message": message or "The plugin did not return a valid response"} diff --git a/src/ui/static/js/plugins/utils.js b/src/ui/static/js/plugins/utils.js index 43a994c31..3e1883623 100644 --- a/src/ui/static/js/plugins/utils.js +++ b/src/ui/static/js/plugins/utils.js @@ -82,6 +82,30 @@ class Ping { // Key of fetch data need to match key of this.data updateEl(data) { + // Show error + if (data?.error) { + const error = data?.error || "Action exception, no details available"; + console.log(error); + // Remove previous data-action-error + const prevError = document.querySelectorAll("[data-action-error]"); + if (prevError.length) prevError.forEach((el) => el.remove()); + // Add this one + const error_html = `
+(Action error) ${error}
+