I have struggled with this since day 1. It probably doesn't help that I've been surrounded by a lot of code that doesn't even handle errors at all.
Anyway, I'm working with WebForms in your traditional n-tier design: UI->BLL->DAL. Usually what I do (and I know it's not right) is to try/catch my data operations. If there is an exception I simply throw it to bubble up.
try
'db operations
catch ex as exception
throw
finally
'close connections
end
So then it bubbles up to the BLL and in there is another try/catch where I'll log the error. Now I want to alert the user that something is wrong so I throw it again, this way it bubbles to the UI. At the UI level, I will wrap in a try/catch and if there's an error I'll display a friendly message to them.
What are your thoughts? What can I do better here?