Friday, June 23, 2006

Exception Handling Logic

Is it good practice to include all non-exception causing code inside a try block?

If you have a sequence of operations which should be aborted if an exception occurs, then that's exactly what a try block is for. And as a general principle, try blocks should be as large as possible, for this makes the flow of the normal code clearer, and concentrates error handling in one place.

0 Comments:

Post a Comment

<< Home