Skip to content

Conversation

@dilyanpalauzov
Copy link
Contributor

For:

Thing mqtt:topic:r (mqtt:broker:b) {
  Channels:
    Type string : a [stateTopic="a/b", transformationPattern="DSL:|O_N.toString()"]
}

before this change:

2025-09-25 04:57:05.588 [DEBUG] [nelTransformation$TransformationStep] - Applying TransformationStep{serviceName='DSL', function='|O_N.toString()'} failed: Failed to execute script.

after:

2025-09-25 05:03:48.524 [ERROR] [nelTransformation$TransformationStep] - Applying TransformationStep{serviceName='DSL', function='|O_N.toString()'} failed:  ___ O_N.toString()
   The method or field O_N is undefined; line 1, column 0, length 3

This changes the logging level to Error, so that syntax errors are logged. ScriptException is logged on other places with level ERROR . Disadvantage of this change is that the same syntax error will be logged many, many times, in fact each minute, until it is fixed for the channel.

If you ask me, similar change must be done on all places with catch (org.openhab.core.transform.TransformationException), but I do not know how to trigger execution over these places.

@dilyanpalauzov dilyanpalauzov requested a review from a team as a code owner September 25, 2025 04:47
@dilyanpalauzov
Copy link
Contributor Author

This change is very good, but for channel

Type number:c [stateTopic="b/d", transformationPattern="JSONPATH:$.u[m]"]

with TransformationException e e.getMessage() is “An error occurred while transforming JSON expression.”, e.getCause().getMessage() is “Could not parse token starting at position 3. Expected ?, ', 0-9, *” and this.function is “$.u[m]“.

I think in this case it is useful to log both e.getMessage() and e.getCause().getMessage(), but currently only the former is logged.

@openhab-bot
Copy link
Collaborator

This pull request has been mentioned on openHAB Community. There might be relevant details there:

https://community.openhab.org/t/java223-scripting-script-with-java-on-openhab-5-0-1-0-6-0-0-0/159853/45

Copy link
Member

@wborn wborn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the sign offs of your commits.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants