Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Error Handling (http://www.velocityreviews.com/forums/t385228-error-handling.html)

Uriah Piddle 01-16-2007 02:50 AM

Error Handling
 
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/karlsegu...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 01-16-2007 11:38 AM

Re: Error Handling
 
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" <stephenprescott@msn.com> wrote in message
news:OwY4DkROHHA.4992@TK2MSFTNGP04.phx.gbl...
> 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/karlsegu...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] 01-16-2007 02:20 PM

Re: Error Handling
 
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" <pbradley@uwic.ac.uk> wrote in message
news:umsfpLWOHHA.140@TK2MSFTNGP04.phx.gbl...
> 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" <stephenprescott@msn.com> wrote in message
> news:OwY4DkROHHA.4992@TK2MSFTNGP04.phx.gbl...
>> 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/karlsegu...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
>>
>>
>>

>
>




All times are GMT. The time now is 08:29 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.