Page 1 of 1

Error handling in a batch processor

PostPosted: Tue Jun 10, 2008 2:14 am
by amcgilly
I have written a batch processor that is monitoring a port and continuously processing packets. It has happened on occasion that after making changes/upgrades to the code, it has run into a programming error and stopped running. I was hoping I could use an error handler to get it to recover from the error, but so far it hasn't worked.

First I tried an error handler that just reported the error to a log. After reporting the error, it just stopped running.

Next I tried having the error handler restart the solution using closeSolution(solution_to_open, parameters), but this doesn't seem to work for batch processes - an un-named headless client is started (shows up in the admin console with no name) that doesn't appear to be doing anything.

Next I may try using Scott Buttler's Robot plugin to close and restart the batch process.

Any thoughts/ideas are much appreciated. Thanks.

PostPosted: Tue Jun 10, 2008 5:26 pm
by sdevlin
Hi Adrian,

Are you running your code inside of a try/catch block or deferring the handling to onErrorHandler ?

PostPosted: Tue Jun 10, 2008 10:06 pm
by amcgilly
I'm just putting code in a globals.onError method which is specified as the On Error method in the solution settings.

If I'm not mistaken, try/catch blocks work when you know ahead of time what lines of code you think might fail. If that's correct, then that's not really so useful to me in this case. I just want to make the batch processor keep chugging even after it runs into an error (any error), because chances are the error is related to one of hundreds of ongoing communication sessions, and there is no need to stop all comm sessions just because one of them has run into trouble.