What exception should I catch ??

R

Roger Down

I've read somewhere that it's not a good idea (or design) to catch all
exception in one (big) catch(Exception e)... but instead catch the
respective exceptions thrown by the respective classes used in a try
section...

When working with webservices, what soap related exceptions should I catch
?? Is it enough to only catch a SoapException, or is there other important
exceptions which I need to catch... so be safe... like network timeout,
formatting error... I guess there are several layers in work when
generating, sending and receiving a soap message/response...

best of regards... :)
 
J

Jim Cheshire [MSFT]

Roger,

I would not be comfortable with a blanket statement like that. It is
entirely dependent upon your architecture. What you generally want to do
is catch specific exceptions when you need to take specific action based
upon that exception. At the end of your try...catch block, you can catch a
generic exception.

For what it's worth, it's also a very good idea to implement an event for
the UnhandledException. You can do this in your Application_Start so that
anytime an exception is thrown that you didn't handle, it can be handled by
your UnhandledException handler.

Jim Cheshire, MCSE, MCSD [MSFT]
ASP.NET
Developer Support
(e-mail address removed)

This post is provided as-is with no warranties and confers no rights.

--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top