Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 382079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:08:51+00:00 2026-05-12T15:08:51+00:00

I have struggled with this since day 1. It probably doesn’t help that I’ve

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T15:08:52+00:00Added an answer on May 12, 2026 at 3:08 pm

    As I understand, you have three try/catches – one for each tier: DAL, BLL,UI.

    You should only catch when you are going to do something about it.

    From what I understand, you simply retrow from DAL so there’s no need for it.

    From BLL you log the exeption and that is a good practice since you’ll be able to collect data about exceptions to eventually improve the application.

    Then you catch at the UI tier to translate the exception into something user friendly. That’s OK.

    So I would only get rid of the try/catch from the DAL layer – if you really don’t do anything more than retrowning the exception.

    In some scenarios, it can be usefull to add an identifier at the BLL that is passed to the UI exception and shown to the end users so that if they call support, support personel can correlate the given Id with an exception on the server’s log.

    That can be done, for instance, adding a Guid or something else meaningfull and unique to Exception.Data collection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Have you guys had any experiences (positive or negative) by placing your source code/solution
Have you managed to get Aptana Studio debugging to work? I tried following this,
Here is a problem I've struggled with ever since I first started learning object-oriented
I was wondering how other people implemented this scenario. I have an internal rails
I've been creating a small application that allows a user to convert images to
I have been taken in to provide some SEO guidance on a website which
I have the following code written to make my lazy second CPU core working.
Have just started using Google Chrome , and noticed in parts of our site,
Have you ever seen any of there error messages? -- SQL Server 2000 Could
Have just started using Visual Studio Professional's built-in unit testing features, which as I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.