-
-
Notifications
You must be signed in to change notification settings - Fork 31
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
Error java.lang.IllegalArgumentException: Invalid type '{com.oracle.truffle.polyglot.PolyglotMap}' of configuration value!
does not show its location in the .js file
#176
Comments
The problem why there is no stack trace in this case, is that the error occurs in the Java layer of openHAB and only the message of the exception is logged. To solve this, we have two options:
I‘ prefer the second option, as this would help with debugging in all cases of errors during the script loading, regardless where they occur. @jpg0 WDYT? |
|
@florian-h05 I believe that the policy for the Java layer is that stack traces are not logged, except for unanticipated errors within openHAB, indicating that a core fix is required. @kaikreuzer would be able to confirm this. |
Okay, but I am wondering if we could have an exception from this policy here, because the logged message clearly says that it is a script problem ( If we can't, what would be your proposal to avoid such problems? I've also encountered this when I passed the wrong pramater to the Item history classes methods. Introducing type checks for all our wrapper functions is no solution in my opinion. |
I‘ve modified the add-on to print the stack trace, but seems like the stack trace doesn‘t help in this case: Stack trace
I can not find any reference to the script in the stack trace. So seems like we should add type checks to openhab-js. |
Please permit to |
Whilst I will add that functionality, I am wondering why you haven't just passed the item name to the trigger instead of the Item (supposing that my_array holds the Items): rules.JSRule({
triggers: my_array.map(y => triggers.ItemStateChangeTrigger(y.name)),
execute: (data) => {
console.log(data)
}
)) |
Because I have forgotten that I have to pass strings. |
When I create a JS rule as in
and the elements of my_array are Items (not strings), openHAB 3.3 logs:
The error disappears once I pass to triggers.ItemStateChangeTrigger() a string.
The error message
2022-11-24 09:58:11.273 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/etc/openhab/automation/js/zz.js': java.lang.IllegalArgumentException: Invalid type '{com.oracle.truffle.polyglot.PolyglotMap}' of configuration value!
is very unclear on the exact problem and its location.
Please extend openhab-js to print in such cases the line and column, where the error occurs, and hint that the problem is wrong type passed to
triggers.ItemStateChangeTrigger()
.The text was updated successfully, but these errors were encountered: