Good Book on Exceptions

  • Thread starter Thread starter nashak
  • Start date Start date
N

nashak

Hello,

Can you recommend some good books on Exception Handling (at all levels
- UI, Biz and Data)?

Thanks,
 
I'm not sure if you could fill a book on that subject. How about reading the
documentation on the Exception classes?
 
Nashak ---

There might not be a book on exceptions (I have for one never had the urge
to read a full book on exceptions, maybe nobody else had the urge to write
one .. but I might very well be mistaken).

However, check out the exception handling application block ... that is
covers neatly all the aspects of handling exceptions in various layers. Also
look at the logging block which is a superset of that - that's kinda neat
too, but overtly complicated in my eyes for atleast my purposes.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
 
Hello,

Thank you for your responses.

I am in the process of designing a new application that has three
layers - UI, Business and Data and was wondering what the industry best
practices are for ex exception handling.

Business Methods may call other business methods that can call data
methods. What is the best way to catch exceptions that can occur at
either business or data layer or even UI layer? What layer should catch
exceptions or should each layer catch its own exception? Should each
method, where exception occurs, catch these exceptions? i.e what are
some standards, best practices etc. etc.


Thanks
 
Exception handling isn't rocket science. Use your own judgment and you'll be
fine.
 
Here is what i recommend -

Catch only what you are supposed to. So in your catches don't do
catch(Exception e). And don't catch all kinds of exceptions - don't over do
it.

As long as you do that .. you should be okay.

In other words - don't mask exceptions - don't let your callers believe
nothing went wrong when it indeed did.

Another thing is - always have a catch all for all uncaught exceptions. So
like an error page for an asp.net app.

Third thing - take exception to exceptions - when you do catch an uncaught
exception in your catch all - write a robust but simple code to extract as
much as info as possible from the exception to present to the end user, and
if possible allow a direct feedback so before the customer reports it - you
might have already fixed it. I've sent emails at times that look like ..
"Today at 9:38 AM you were running this report and you got this error. Well
I've fixed this, please try again". The customers are really pleased to have
a problem fixed without them reporting it.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
 
Back
Top