Gateway Script Error

Recently I updated a project from 7.9 to 8.1. I have error collection set up to add entries to the log when a script fails but I’ve noticed in 8.1 if a tag write fails it doesn’t trigger my error collection. Anyone have a suggestion?

I have something like this in a gateway timer script:

import traceback
import sys

except Exception, err:
	exc_type, exc_value, exc_tb = sys.exc_info()
	errtb = traceback.format_exception(exc_type, exc_value, exc_tb)
	errStr = str('Text describing script: '+str(err)+errtb[1] + errtb[2])
	logger = system.util.getLogger("text")

This is the only entry I see in the logger when a tag write fails:

Is that script calling writeBlocking directly or one of the deprecated tag write calls from 7.9?

1 Like

It was originally a writeAll from 7.9 but I updated it to writeBlocking because the legacy script error description didn’t help in identifying what caused the error. I found the script that caused the error but where it didn’t trigger my try/except I didn’t have anything to point me to which script did it. When it gave the error I posted it was using the writeBlocking.

What 8.1 version is this? Trying to get the line numbers to match up and see if an exception should have been thrown earlier or not.

This is 8.1.1.

Hey @Kevin.Herron, did you find anything with where the exception is thrown? Should it be thrown earlier or do I need to add more error catching some how for when a tag write fails?

There is an incorrectly implemented sanity check on tagPaths vs values list sizes in that AbstractTagUtilities::writeBlocking method that causes the call to continue on to a deeper system that has the same correctly implemented check, but logs and returns bad results rather than throwing the Exception.

There is nothing you can do to catch an Exception here, you’ll have to check the results instead. We should be able to fix this particular case though.

Ah, looks like somebody already fixed this. It’ll be in 8.1.4.

Thats great! I was just looking at ways for doing a sanity check myself before doing the write. If its already fixed I won’t go to far into it.

Thank you!