Suppress Error Message - Error writing to tag

Hi,
This is a legit error, but I am searching for a way of handling this error in a custom way -not having Ignition bring up this default Error message.
-Is it possible?
This example is when using system.tag.write()

image

How are you trying to write to the tag, a binding or a script? (Or other I suppose.)

1 Like

You would use a try: … except: block in python.

3 Likes

For info: In this example I am writing to an OPC tag with bad quality.
-Actually I was manipulating the tag from within a template. Writing to the UDT property representing the tag. My first post was not accurate…
image

When switching to system.tag.writeAsync() or -Blocking() functions the Error message does not show in the client. I will consider using this approach instead

I get the same error message appearing when manipulating a bad-quality OPC tag directly in Designer/TagBrowser - which is perfectly fine.

I was just wondering since some earlier posts mentioned an additional argument for the tag.write function for suppressing errors…

case closed ;-).

You were writing through a binding, even though in a script. Bindings display their own error messages because they are often triggered directly by UI operations.

I see. Would there be a best practice to handle / catch an error when writing through a binding?

There’s not really anything you can do after the fact. A binding can’t let an exception pass through to a calling script because there may not be a calling script, and there’s no practical way for a binding to know. You’ll need to check the quality of the tag before attempting to write to the bound property.

1 Like