Last post Nov 21, 2010 09:52 PM by worldspawn
Nov 21, 2010 08:12 PM|pkarun007|LINK
My question is, I have a PL, BL and DAL layered architecture (In which all these components are hosted in a single web server).
With the above architecture, i have only placed try catch block in all my events in aspx.cs pages in PL ALONE and NO TRY CATCH BLOCK IN BL AND DAL.
There is one command timeout exception happening at the DAL layer and the exception bubbles back to the PL(aspx page event which is having the try catch block). This try catch block catches the exeption and logs the exception information to database and
displays useful information in the UI.
WIth the above approach, sometime very rarely(only once till now) exception is not caught in the PL for the commandtimeout exception thrown from DAL implicitly.
I confirmed the exception is not caught because the exception information is not logged into the database and also no useful information displayed in UI.
So what is the issue here? Why the exception from DAL dint bubble down to PL? Do we need to explicitly throw exception from DAL or BL i.e by having try catch block in BL and DAL ?
Nov 21, 2010 09:52 PM|worldspawn|LINK
Unsure of the issue.
Unless your catch code does something to "handle" the error (not just log it) I would move that code to catch all unhandled exceptions.
You can do that by using the application error event in the global.asax file. See this:
Edit: How do you know about the error if none of it's information is captured. Does your "logging" log to the database, if so then perhaps your catching the error and then trying to log it but your saving of the information back to the database is then failing.