Power Table Extension Functions handle exceptions silently

It appears that when the Power Table Extension Functions encounter an exception, they fail silently. They do log the exception and the stack trace to the console, but unless the user is monitoring the console, they will not know that anything went wrong.

The exception can be caught and handled in the script, so I can write in my own pop up for the user. But I don’t know how to generate an errorBox which includes the “report error” that I usually see when an exception is raised in the Vision projects. Is this something that I can write my own function to do, at least until this problem is resolved?

Use ErrorUtil - take a look at the various overloads for showError, eg:
http://files.inductiveautomation.com/sdk/javadoc/ignition81/8.1.0/com/inductiveautomation/ignition/client/util/gui/ErrorUtil.html#showError(java.lang.String)

from com.inductiveautomation.ignition.client.util.gui import ErrorUtil
try:
    pass
except java.lang.Exception, e:
    ErrorUtil.showError("Component X threw an uncaught error", e)
2 Likes

Thanks, Paul, that will cover most cases. Is there something that will work like this for python Exceptions? Or a simple way to get a java.lang.Throwable out of a python Exception? If not, I suppose we can always handle the two separately.

Copying Phil always works :slight_smile:
He's got a PythonAsJavaException class in his later.py utilities package:

2 Likes

Thanks to you both, that seems to do the trick. At least until Extension Functions can be made to handle this like other component functions do.

Sigh. I wish. /: