Error Handling

Discussion in 'ASP .Net' started by Uriah Piddle, Jan 16, 2007.

  1. Uriah Piddle

    Uriah Piddle Guest

    Hi Gang,

    I read a blog by Karl Sequin on catching errors and it has been sinking in
    and I can see the merits. The gist of it is that you really should catch
    only those errors that you can actually resolve in code and let the rest of
    them (the vast majority) blindly bubble up to the global error catcher. Here
    is the blog:
    http://codebetter.com/blogs/karlseguin/archive/2006/04/05/142355.aspx.

    I infer from this that you should not really be writing a whole lot of Try
    Catch Finally blocks -- pretty much just cleaning up with Finally or Using
    statemtnts and letting nature take its course.

    I really can't think of a reason not to follow this method but I was
    wondering if I'm missing something.

    Thanks for any ideas.

    Steve
    Uriah Piddle, Jan 16, 2007
    #1
    1. Advertising

  2. Yup. It's what we do, more or less. The important thing is to ensure that
    you catch every exception in the end and do something with it like redirect
    to a global error page that says something nice and user friendly and allows
    the user either to get back into the application, or abort. As it happens,
    we do this in global.asax.

    The most unprofessional thing I see on asp.net sites are the default error
    messages that result from uncaught exceptions. They are not user friendly
    and they give away far too much information about how your application is
    structured.

    Just my 2c


    Peter


    "Uriah Piddle" <> wrote in message
    news:...
    > Hi Gang,
    >
    > I read a blog by Karl Sequin on catching errors and it has been sinking in
    > and I can see the merits. The gist of it is that you really should catch
    > only those errors that you can actually resolve in code and let the rest
    > of them (the vast majority) blindly bubble up to the global error catcher.
    > Here is the blog:
    > http://codebetter.com/blogs/karlseguin/archive/2006/04/05/142355.aspx.
    >
    > I infer from this that you should not really be writing a whole lot of Try
    > Catch Finally blocks -- pretty much just cleaning up with Finally or Using
    > statemtnts and letting nature take its course.
    >
    > I really can't think of a reason not to follow this method but I was
    > wondering if I'm missing something.
    >
    > Thanks for any ideas.
    >
    > Steve
    >
    >
    >
    Peter Bradley, Jan 16, 2007
    #2
    1. Advertising

  3. My $0.02 might not be worth too much since you already know my opinion. But
    in that blog post, I quote (and link to) a really good interview by Anders
    Hejlberg - C#'s lead architect. The link is
    http://www.artima.com/intv/handcuffs.html and he talks about the point in
    question on page 2.

    I think you'll be hard pressed to find someone reasonable who'll disagree.
    Even Java zealots have started to turn around.

    Karl
    --
    http://www.openmymind.net/
    http://www.fuelindustries.com/


    "Peter Bradley" <> wrote in message
    news:...
    > Yup. It's what we do, more or less. The important thing is to ensure
    > that you catch every exception in the end and do something with it like
    > redirect to a global error page that says something nice and user friendly
    > and allows the user either to get back into the application, or abort. As
    > it happens, we do this in global.asax.
    >
    > The most unprofessional thing I see on asp.net sites are the default error
    > messages that result from uncaught exceptions. They are not user friendly
    > and they give away far too much information about how your application is
    > structured.
    >
    > Just my 2c
    >
    >
    > Peter
    >
    >
    > "Uriah Piddle" <> wrote in message
    > news:...
    >> Hi Gang,
    >>
    >> I read a blog by Karl Sequin on catching errors and it has been sinking
    >> in and I can see the merits. The gist of it is that you really should
    >> catch only those errors that you can actually resolve in code and let the
    >> rest of them (the vast majority) blindly bubble up to the global error
    >> catcher. Here is the blog:
    >> http://codebetter.com/blogs/karlseguin/archive/2006/04/05/142355.aspx.
    >>
    >> I infer from this that you should not really be writing a whole lot of
    >> Try Catch Finally blocks -- pretty much just cleaning up with Finally or
    >> Using statemtnts and letting nature take its course.
    >>
    >> I really can't think of a reason not to follow this method but I was
    >> wondering if I'm missing something.
    >>
    >> Thanks for any ideas.
    >>
    >> Steve
    >>
    >>
    >>

    >
    >
    Karl Seguin [MVP], Jan 16, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kenneth Keeley

    Error Handling

    Kenneth Keeley, Jul 1, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    370
    Kenneth Keeley
    Jul 1, 2003
  2. VSK
    Replies:
    1
    Views:
    764
    Alvin Bruney
    Jul 29, 2003
  3. Mark Tarver
    Replies:
    22
    Views:
    1,274
    J Kenneth King
    Apr 26, 2009
  4. Peter
    Replies:
    34
    Views:
    1,911
    James Kanze
    Oct 17, 2009
  5. Iñaki Baz Castillo
    Replies:
    1
    Views:
    174
    Iñaki Baz Castillo
    Apr 15, 2008
Loading...

Share This Page