none
Exceptions in layered application RRS feed

  • Question

  • Hi

    I am farily new to developing front-end applications and I had a few questions with the first  major app development effort that I am working on currently. So, kindly pardon me f any of my questions look silly.

    I have created DAL, BLL, custom business entities/collections in my application (all of them reside on the same machine where the UI will reside). I have used the Enterprise Library Data Access Application Block extensively. I am planning to use the Exception Handling block to handle exceptions and log the same in a database. I read many aritcles regarding this and I am yet to get a clear picture of managing exceptions in each layer.  Currently, I have set my exception policies in the config tool like this:

    DAL will catch any data layer related exceptions, log it and replace with a custom Data Layer Exception (to hide sensitive data) and rethrow it. This would not be caught by the business layer, but would propagate to the UI.

    BLL will catch any business rule violation exception in that layer, replace it with a custom business layer exception and rethrow it. (no logging).

    The UI which is being developed by a co-worker will look for these exceptions (customd at layer and business layer) and also any other general exceptions and display it appropriately in the relevant page or re-direct to error page.

    Is this a better way or are there any other best practices in this regard?

    I am concerend if catching and re-throwing causes a performance degradation.

    Please advise.

     

    Thanks

    TSR

    Thursday, March 9, 2006 5:24 PM

All replies

  • Just that make sure you don't catch and re throw if you are not adding any value to the exception object(lets say putting a new attribute value etc)

    Let the exception propagate without those dummy catch and re throws that don't add much value to the exception information.

     

    Friday, March 10, 2006 7:28 AM