Catching exception in webdev doPost

I have a try/except block inside a for loop on a doPost.

A named query is executed for each element inside the loop. If there is an exception, I catch it and continue to try the next element.

Since the try/except is inside the for loop, I wouldn't think that I need an explicit continue statement, but whether I use one or not, the for loop drops out and no other elements are tried.

Continuing (with and without an explicit continue) works in straight python and in the Script Console, so is there some issue/caveat with webdev?


The exception being thrown might be a Java exception, rather than a Python exception?

Yea, that works. But it's still a head scratcher because the plain vanilla except Exception as e: did catch (and logged a message for me).

Right, it probably was caught at the outer layer of "the webdev module". Unless you're saying you caught the message but your for loop still dropped out.

1 Like

Yes I didn't notice it was the PythonResource logger that had the message.


1 Like