When to use try/catch
- by coffeeaddict
I'm always finding myself wanting to put a try/catch around the lets say Business Layer methods. But I feel though that I don't need a try/catch if I'm simply rethrowing it up to the Presentation Layer. Is that right? I should not be rethrowing an exception from code that's wrapped in a try/catch in a BL method and should be letting the caller which would be from the Presentation Layer code be using a try/catch to handle it there?
The BL method will throw an error without the try/catch anyway..the compiler will. So it wouldn't make sense to use a try/catch in a BL method that's to be consumed by a layer higher up correct?