Showing posts with label Exceptions. Show all posts
Showing posts with label Exceptions. Show all posts

Thursday, July 2, 2015

Exception Handling not working on Server

This is important stuff. Nothing sucks worse than when Exception Handling actually breaks your application.  And nothing sucks worse than when something behaves one way locally and a different way once it gets deployed to your server.

As this article explains, you can have a global error handler in your Global.asax file that gets fired on your local machine, but if your web.config file is lacking a CustomErrors setting, it won't work on an IIS server.

So be sure your web.config has this section:

<customErrors mode="On|Off|RemoteOnly" />

and for starters, set it to:

<customErrors mode="Off" />

Tuesday, July 10, 2012

Everything in a Language Stems from a Historic Need

I remember wondering what the big deal was with the Exception type. I guess it was annoying not being able to return an error from, say, constructors:

"The use of exceptions adds to a consistent framework design and allows error reporting from members, such as constructors, that cannot have a return type." - http://msdn.microsoft.com/en-us/library/ms229014