In a web application, we do not have access to the Console.
And quite often, in order to share a class across the entire web
application, we put it under App_Code.
Normally, classes placed under App_Code do not inherit
System.Web.UI.Page, and therefore do not have access to Response.Write
or any of our Web controls.
Nor do we have a console.
So, here is my question: How do we handle exceptions thrown from, for
example, App_Code\MyClass.cs ?
Should we say something like below?
try
{
// blah blah
}
catch(SqlException se)
{
throw new Exception(se.Message);
}
Thank you!
Re-throwing Exceptions is more expensive (on the performance of the
application) than letting the exception to propagate automatically. So if
your class App_Code\MyClass.cs does not do anything with a caught exception,
remove the try ... catch block from it and let the web page to handle it.
You might find this article helpful:
http://msdn2.microsoft.com/en-us/library/ms954599.aspx#emag__exception_propagation

Signature
Regards,
Phillip Williams (MCPD Web Developer)
http://mcts-study-practices.com/
http://www.webswapp.com
> In a web application, we do not have access to the Console.
>
[quoted text clipped - 22 lines]
>
> Thank you!
gnewsgroup - 22 Sep 2007 05:01 GMT
On Sep 21, 3:44 pm, Phillip Williams <WEBSW...@newsgroups.nospam>
wrote:
> Re-throwing Exceptions is more expensive (on the performance of the
> application) than letting the exception to propagate automatically. So if
[quoted text clipped - 33 lines]
>
> > Thank you!
OK, thank you very much. I haven't been a good exception catcher.
But your idea helps clarify a major exception principle. Thank you.