openhab / openhab-js

openHAB JavaScript Library for JavaScript Scripting Automation
https://www.openhab.org/addons/automation/jsscripting/
Eclipse Public License 2.0
38 stars 31 forks source link

Rules: Logged error on failed rule run doesn‘t contain any error information #115

Closed florian-h05 closed 2 years ago

florian-h05 commented 2 years ago

Expected Behavior

I would expect that the logged message includes a detailed error message like the following:

org.openhab.core.items.ItemNotFoundException: Item 'Aussenlicht' could not be found in the item registry

Current Behavior

When a JSRule run failes, a message like that is logged:

2022-05-16 22:31:24.256 [ERROR] [e.automation.internal.RuleEngineImpl] - Failed to execute rule 'Test-Rule-2c1e38ee-dec4-432f-b0ab-cd3192361c04': Fail to execute action: 1

Possible Solution

I think I already have some solution, but this required additional testing. I will soon open a PR.

Steps to Reproduce (for Bugs)

  1. Create a JSRule that will produce an error, e.g. by using items.getItem() on a non existing Item.
  2. Run the rule.

Your Environment