Exception handling hurts my head
Hi All,
Im having a little trouble getting my head around handling exceptions in a process that has several stages.
If anyone can describe the correct apporach at a high level that would be very much appreciated.
Basically, I need to respond to a request for information via a web service.
If any of the stages in the processing of the request fail the message still needs to be sent back but with an appropriate error code/message from the interface system.
Do I need to nest my try catch blocks to ensure that code is not excecuted after an exception has been thrown?
So if I trap an database error and then go to excecute the more code that may rely on variables set from previous database call, I would expect them to fail too.
But that exception will replace the real error in the response message.
Does throwing a new exception of whatever type I decide exit the method?
======================================
They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad.
======================================
__________________
======================================
"They say, best men are molded out of faults,
And, for the most, become much more the better
For being a little bad."
--Shakespeare
======================================
|