Peter Morris said:
If you don't know at which line the exception occurs then you do not know in
which state your application has been left.
That's why you have a stack trace, and you do know at what line a solution
blew on, which of course is being logged.
The whole world doesn't run based on your filestream example of execption
handleling.
If you trap explicit exception
types it is because you know to expect them, why they happen, and how to put
your application back into a known state.
Well, what if the application is Web application and state is out of the
question, becuase state is lost on each round trip?
What if the application is a Windows Service application, it's calling a Web
service or a WFC Web service and the Web service blows? How is the
application going to hold state? The one thing I do know is that if I log the
execption in the Web service, then I will know.
If you just trap all exceptions
than you have no idea why it occurred nor what state your app is in. As a
consequence your app could continue to run but corrupt important data.
Well, I have seen that.
WEB UI makes asynchronous calls to the Web service to to display data on
the UI , Web service calls the BL tier, the BL makes a call to another Web
service to access the DAL tier, something happened in the tier that actally
blows out the thread using the Web service, the application never stopped
and the UI continues to process to dispaly data on the screen.
That's the way it is, becuase you're not the person in charge. Everything
doesn't fit in one shoe, and the shoe doesn't fit all situations.
We can go on and on about this. I have my way of doing things with exception
handling, and I may or may not use a *finally*. If I don't need the
*finally*, then I am not using it for the sake of using it.
Also, if an exception occurs, one may or may not do anything about it. It
all depends upon the circumstances placed upon someone, not placed upon
someone or the situation.
I am tired of this thread, and I am moving on.