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?
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
Originally Posted by kantesh13
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?
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..
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.
Bookmarks