This code used to work correctly each time but now my runPrepUpdate executes and then nothing ever happens. The code just ends. Even the try/except doesn’t execute.
Anyone know what is going on or have seen this before?
Is the data being inserted? If not, consider adding an except clause specifically for java.lang.Exception. An except clause for python’s Exception class won’t catch java exceptions.
It doesn’t seem to give me any useful information other than the insert fails but now I’m thinking it’s because I keep inserting the same PRIMARY KEY over and over.
I want to say that before it was returning an error for this and not just stopping without an error but I’m not 100% sure.
If I want to catch these types of errors do I always need to use java.lang.exception? What are Exception, e errors for then?
The Exception as e is the very generic error catch for Python 3.x. Not all error are programmed to raise the generic Exception for python, and for various reason.
Python's Exception classes inherit from PyObject, while java exceptions inherit from java.lang.Throwable. They simply don't have a common parent class, so can only be caught in the same except clause when you specify no exception class at all. If you need to catch them both with the explicit syntax, use two except clauses.
See also:
Also note that java exceptions can have a chain of "causes" you can follow for more detail. Though some of that detail is lost in serialization when exceptions are reported from gateway to client.