Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.
Originally posted by: sdbThanks Stony, Ryeh and Tim.
I did think of these workarounds - and I think they would all work, but I was hoping for something slightly different, particularly as the library I am using has multiple calls, and wrapping try/except around each makes it very hard to read, although I do use the technique when testing a status. Also multiple outputs is not that pretty as people do not readily understand what each is for - even with documentation.
Tim's suggestion is a good one for graphs destined for automation - of which this is one - but I wanted to get into some fundamentals for desktop users too.
I was hoping to create a global exception handling: perhaps my knowledge is limited re the brain.node exception handling system as to whether this is possible. As much as I understand is that "raise..." will terminate the node with no output, no clock and a red X. Switches and MetaChecks will not get triggered, even where their input is homed to a data output on another node.
So is there a way to get a red X by other means, but still at least clock? If so a simple Metacheck would allow/disallow normal data processing when there is at least 1 record output, and a Switch can be used to propagate alternate data that an error handler can spot and deal with.
The best I have achieved so far is to manipulate the return code (0, 201 or 203) to the circumstance, and have to do a premature "return" from initialise, prevent pump running if my global terminate flag is set, and similarly test in finalise whether there should be any cleanup according to how far initialise got.
It's ugly, complicated, and crying out for better global exception handling.
Any other ideas?
Grateful for your suggestions.
Thanks again!
I already introduced try/except constructs in the Python code