Reputation: 15545
I have web application with Presentaion layer,Business Layer,Data Access Layer. I am getting data by web service which is connected with my Data Access Layer.Means it is one of type of remoting i am using. Which exception i must handle in this scenario, in my DAL and Business Layer? Please guide me.
Upvotes: 1
Views: 81
Reputation:
I view a Webservice as just another form of Presentation layer. It should be using the same business layer components as your Web UIs, wherever possible.
Even in fairly basic REST style services, I try to always incorporate a basic Response wrapper around the requested data - this ensures that in the event of a failure, I can still return a response with an Error flag set, and hopefully some form of descriptive message.
I always try to ensure I'm not passing exception data from lower layers (eg DAL) as this can be a security issue. That exception data should generally be logged, however.
Upvotes: 1
Reputation: 71
I think you should not handle any errors at Data Access Layer or Business Layer. You simply have to throw it to next layer, so at last you have an error/exception at Presentation Layer. All the error/exception should be handled at Presentation Layer, the reason behind it is..
Still, This is my opinion and there is no hard and fast rule for that. I am also agree with "Niko" to handle such things at Business Layer.
Following article may give more light on architecture (still it is not on error handling). - http://www.codeproject.com/KB/cs/CLR_SP_Linq_n-tier.aspx
Upvotes: 0
Reputation: 15756
Layer architecture is notoriously poor at following the natural flow of your app, so, well, you have some choice there. I like to put this sort of code into the business layer, although I couldn't make a compelling case for it to save my life.
Upvotes: 0