Try() in expression binding doesn't stop error from being logged

Ignition 8.1.13

I have a custom property with an expression binding:

try(addHours({[MyTagProvider]MyTag}, {this.props.MyOffset}), now())

Note that the addHours() is wrapped in a try(). Despite this, I still occasionally get the following error logged:

Does the try() not catch the error from addHours()? or does addHours() trigger an error log regardless?


Consider using coalesce() around MyTag instead–it is explicitly intended to handle nulls.

Thank you. And I had already added the coalesce(), but I use the try() construct in several places to simplify error handling and wanted to know specifically if it should have caught this error or not.

For instance, addHours() will also log an error if the 2nd param is null. Which means I have to add coalesce() around it as well. You can imagine more complex expression bindings where I now have a dozen extra coalesce() calls and defaults, etc. where I would like to simply wrap the entire thing in a try() and be done with it.

So, is try() designed to catch errors like this or not? Should it have stopped the error from being logged?


I would think so, but I’m not IA. My comment was intended as a work-around, because even if IA acknowledges it as a bug, it won’t be fixed until 8.1.15 at the earliest, and probably longer.

Consider mentioning in your OP the things you are doing/have done to mitigate a problem, which will avoid non-useful suggestions from the peanut gallery.

1 Like

That’s the point, try catch errors, not warnings. The log you’re showing is a warning :warning: .

I wouldn’t think that is the difference.