Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add identifying information to timers for errors #2750

Closed
rkoshak opened this issue Feb 11, 2022 · 0 comments · Fixed by #2911
Closed

Add identifying information to timers for errors #2750

rkoshak opened this issue Feb 11, 2022 · 0 comments · Fixed by #2911
Labels
enhancement An enhancement or new feature of the Core PR pending

Comments

@rkoshak
Copy link

rkoshak commented Feb 11, 2022

One of the things that has always been very challenging when writing rules in openHAB, regardless of the language, is correlating an error/exception that happened in a lambda passed to a timer to the rule that it comes from. For example:

2022-02-11 08:27:51.319 [WARN ] [ore.internal.scheduler.SchedulerImpl] - Scheduled job failed and stopped
org.graalvm.polyglot.PolyglotException: ReferenceError: "item" is not defined
        at <js>.:anonymous(<eval>:13) ~[?:?]
        at <js>.:anonymous(/openhab/conf/automation/js/node_modules/openhab_rules_tools/timerMgr.js:29) ~[?:?]
        at com.oracle.truffle.polyglot.PolyglotFunctionProxyHandler.invoke(PolyglotFunctionProxyHandler.java:154) ~[bundleFile:?]      
        at com.sun.proxy.$Proxy518.apply(Unknown Source) ~[?:?] 
        at org.openhab.core.model.script.actions.ScriptExecution.lambda$1(ScriptExecution.java:100) ~[bundleFile:?]
        at org.openhab.core.internal.scheduler.SchedulerImpl.lambda$12(SchedulerImpl.java:184) ~[?:?]
        at org.openhab.core.internal.scheduler.SchedulerImpl.lambda$1(SchedulerImpl.java:87) ~[?:?]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) [?:?]
        at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
        at java.lang.Thread.run(Thread.java:829) [?:?]                

Is there a way to "tag" the SchedulerRunnable with the ruleUID or even offer an optional creteTimer Action where users can pass their own tag so the SchedulerImpl can amend the error message to include this info. This will greatly improve the ability of users to correlate errors caused by their rules with the actual rule that generates the error.

@J-N-K J-N-K added the enhancement An enhancement or new feature of the Core label May 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature of the Core PR pending
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants