In my test I am using MS SQL Server, and although
java.sql.SQLException, the exception in Ignition is never an instance of
from java.lang import Exception as JException
# Something to try.
except JException, e:
sqle = e
print 'Class: %s. Cause: %s' % (sqle.__class__.__name__, sqle.cause)
sqle = sqle.cause
Class: Exception. Cause: com.inductiveautomation.ignition.client.gateway_interface.GatewayException: Parameter x was not defined for stored procedure y.
Class: GatewayException. Cause: com.microsoft.sqlserver.jdbc.SQLServerException: Parameter x was not defined for stored procedure y.
Class: GatewayResponse$GatewayThrowable. Cause: None
In my case, the inner most exception is never an instance of
SQLException but an instance of the inner class
GatewayThrowable. Not sure if this is by design or if this is unintended behavior.
It would be nice, though, to be able to retrieve the actual instance of the exception.