locked
Throwing exception RRS feed

  • Question

  • User1088281417 posted
    Hi my application is  3 layered application(Presentation,Business,Data).So when ever I get exception in Data layer In would like to throw that up to presentation layer then in presentation layer I would like to publish the excepition to event viewer.in my case what is happening is when I throw from Data to business layer,I see line information where exception is raising in data layer,in business layer's exception statck trace,but same information i can't see in presentation layer?I dont under stand why?what should I do if Ihae to get that?

    Thursday, June 23, 2005 5:31 PM

All replies

  • User-837620913 posted
    In the business layer you should wrap the data layer exception as an "inner exception", like this:

    catch(DataException exception)
    {
    throw new BusinessException(exception);
    }
    Or you could just throw the exception again, but do it this way (if you put "throw new Exception;" you'll lose all the stack trace info):

    catch(DataException exception)
    {
    throw;
    }


    Friday, June 24, 2005 1:41 PM