[automation] Improve rule debugging (#1742)
* Add rule UID to error message * Add exception with stacktrace when debug level is enabled Related to #1734 Signed-off-by: Wouter Born <github@maindrain.net>pull/1744/head
parent
d262b6f5bc
commit
584c85a07f
|
@ -57,7 +57,7 @@ public abstract class AbstractScriptModuleHandler<T extends Module> extends Base
|
|||
private final String type;
|
||||
protected final String script;
|
||||
|
||||
private final String ruleUID;
|
||||
protected final String ruleUID;
|
||||
|
||||
public AbstractScriptModuleHandler(T module, String ruleUID, ScriptEngineManager scriptEngineManager) {
|
||||
super(module);
|
||||
|
|
|
@ -62,7 +62,8 @@ public class ScriptActionHandler extends AbstractScriptModuleHandler<Action> imp
|
|||
Object result = scriptEngine.eval(script);
|
||||
resultMap.put("result", result);
|
||||
} catch (ScriptException e) {
|
||||
logger.error("Script execution failed: {}", e.getMessage());
|
||||
logger.error("Script execution of rule with UID '{}' failed: {}", ruleUID, e.getMessage(),
|
||||
logger.isDebugEnabled() ? e : null);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue