I have a WCF svc separated into a Service Layer, Business Logic Layer and Data Access Layer.
When my DAL encounters an exception, should I catch it there or let it bubble back up to the Service Layer? And why?
Please disregard any client involvement for this scenario, I am only concerned with logging the exceptions on the WCF svc.
There is a term for that - Exception Shielding. Basically you should prevent SYSTEM exceptions to travel to higher level, because this could give an atacker a view of your system architecture. WCF Exception Shielding can catch exceptions of certain type and replace them with exceptions of other type. For example it could catch StackOverflow exception and replace it with your custom SystemException. If you use Enterprise Library you could also configure to log these exceptions when they are replaced
Using the Exception Handling Block in Enterprise Library 3.0
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With