Professional Web Applications Themes

What exception should I catch ?? - ASP.NET Web Services

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... :-)...

  1. #1

    Default What exception should I catch ??

    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... :-)


    Roger Down Guest

  2. #2

    Default RE: What exception should I catch ??

    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
    [email]jamescheonline.microsoft.com[/email]

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

    --------------------
    >From: "Roger Down" <roger.downc2i.net>
    >Subject: What exception should I catch ??
    >Date: Thu, 8 Jan 2004 14:14:30 +0100
    >Lines: 14
    >X-Priority: 3
    >X-MSMail-Priority: Normal
    >X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
    >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
    >Message-ID: <eN$bele1DHA.560TK2MSFTNGP11.phx.gbl>
    >Newsgroups: microsoft.public.dotnet.framework.aspnet.webservic es
    >NNTP-Posting-Host: oslo-bm1-r.consorte.com 212.89.32.1
    >Path:
    cpmsftngxa07.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTN GP08.phx.gbl!TK2MSFTNGP11.
    phx.gbl
    >Xref: cpmsftngxa07.phx.gbl
    microsoft.public.dotnet.framework.aspnet.webservic es:21131
    >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservic es
    >
    >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... :-)
    >
    >
    >
    Jim Cheshire [MSFT] Guest

Similar Threads

  1. Catch VideoError exception?
    By wangal in forum Macromedia Flex General Discussion
    Replies: 4
    Last Post: April 22nd, 07:55 PM
  2. try/catch exception with Lingo objects [x-post]
    By Max in forum Macromedia Director 3D
    Replies: 2
    Last Post: January 5th, 01:16 PM
  3. How to catch COM exception in .Net
    By Franck in forum ASP.NET General
    Replies: 1
    Last Post: August 7th, 06:43 AM
  4. ASP catch exception
    By eddie wang in forum ASP.NET General
    Replies: 0
    Last Post: July 24th, 05:58 PM
  5. Catch Exception Error Message
    By Onur Bozkurt in forum ASP.NET General
    Replies: 1
    Last Post: July 23rd, 12:02 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139