Forum Post: RE: CATCH Brain-freeze

  • Thread starter Thread starter Peter Judge
  • Start date Start date
Status
Not open for further replies.
P

Peter Judge

Guest
There are some exceptions where we want to catch a specific error to handle it right away before it is thrown back up the stack but the ROUTINE-LEVEL definition seems to help with all the rest. I'm not sure if that is a best-practice, but it has worked for us. +1 . FWIW I follow the same approach that Jeff does, with the minor exception that in 11.3 I'll start using the new BLOCK-LEVEL statement which is a superset of ROUTINE-LEVEL. There are a couple of places you should have catches: - Currently you need to add a CATCH on the 'service interface' program on the AppServer (ie the program being called on the AppServer) to catch any errors thrown by the logic called there (since those errors cannot yet be returned/thrown across the AppServer boundary). - If you're using GUI for .NET , you need catch blocks in your ABL event handlers since it's not currently possible to have a global catch during a WAIT-FOR. - Also, from the doc at http://documentation.progress.com/output/OpenEdge113/oe113html/wwhelp/wwhimpl/js/html/wwhelp.htm#href=ABL/ABL%20Reference/16dvref-PR.030.65.html Note these alternatives to the ROUTINE-LEVEL ON ERROR UNDO, THROW statement: Instead of adding the statement to source-code files, you can use the -undothrow 1 startup parameter to change the default error-handling on routine-level blocks to UNDO, THROW during compilation. See the OpenEdge Deployment: Startup Command and Parameter Reference for more information. The BLOCK-LEVEL ON ERROR UNDO, THROW statement can be used if you want to change the default error-handling on REPEAT, FOR, and DO TRANSACTION blocks in addition to routine-level blocks. (You can use the -undothrow 2 startup parameter to change the default error-handling to UNDO, THROW on every block affected by the BLOCK-LEVEL statement during compilation.) -- peter From: Jeff Ledbetter [mailto:bounce-jeffledbetter@community.progress.com] Sent: Wednesday, 05 March, 2014 12:02 To: TU.OE.Development@community.progress.com Subject: RE: CATCH Brain-freeze RE: CATCH Brain-freeze Reply by Jeff Ledbetter Hi. "When CATCH was initially introduced I had hoped that the CATCH would be a more ultimate CATCH (for example at the entry point of an AppServer call), but each block needs to be catching and throwing." That has not been my experience when using the ROUTINE-LEVEL ON ERROR UNDO, THROW. For one of our products, we have a single appserver entry point that catches all App and System errors. There are some exceptions where we want to catch a specific error to handle it right away before it is thrown back up the stack but the ROUTINE-LEVEL definition seems to help with all the rest. I'm not sure if that is a best-practice, but it has worked for us. Stop receiving emails on this subject. Flag this post as spam/abuse.

Continue reading...
 
Status
Not open for further replies.
Back
Top