Click to See Complete Forum and Search --> : exception chaining in .NET ?


kantesh13
05-28-2004, 02:30 AM
Hi

I have a three tier application(front end windows application, webservice, database). If the exception occurs in the database layer then that exception has to propagate through the webservice to front end user.

In java there is a concept called chained exceptions. Does anything similar concept exist in .net framework?

If not how I can propagate the exception and display a user friendly error message to the end user?

Thanks
Kantesh Vernekar

PeOfEo
05-31-2004, 03:13 PM
I am not familiar with chained exceptions in java, even though I know java. Sorry :(

techyashish
08-03-2006, 11:13 AM
yes there is and i think we have to rethrow the exception and exception will be wrapped at each level

i am working on this

Hi

I have a three tier application(front end windows application, webservice, database). If the exception occurs in the database layer then that exception has to propagate through the webservice to front end user.

In java there is a concept called chained exceptions. Does anything similar concept exist in .net framework?

If not how I can propagate the exception and display a user friendly error message to the end user?

Thanks
Kantesh Vernekar

Mike Bell
08-03-2006, 11:24 AM
It should float up until it's caught at whatever level you want. If you don't catch it, it will de displayed to the user. If you have a base Page class that all of your pages derive from, I'd catch it in the Page_Error event and handle it accordingly. If you don't have a model like that... I'd def. recommend it..

saadatshah
08-04-2006, 08:26 AM
Use this chain for exception propogation

In DAL if expection occurs

try{
}

catch (Exception ex){
throw ex;
}

In Web Service if expection occurs

try{
}

catch (Exception ex){
throw ex;
}

In .aspx if expection occurs

try{
}

catch (Exception ex){
// code goes here to show some message to end user
}

The Page_Error event is used as a final handler to the exception raised on a page.