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 6349137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T21:33:22+00:00 2026-05-24T21:33:22+00:00

I write a three tiers web application. DAL BLL and web Presentation Layer,every tier

  • 0

I write a three tiers web application. DAL BLL and web Presentation Layer,every tier has methods , so the question is where should I catch exception( using try catch),in web?BLL?or DAL? and why? thank you.

  • 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-24T21:33:23+00:00Added an answer on May 24, 2026 at 9:33 pm

    An Exception is part of the interface of any method.

     int doSomeThing( ... ) throws Some exceptions
    

    the exceptions may be explicit, as in Java’s Checked Exceptions, or implicit. None the less the caller must anticipate exceptions and decide what to do – sometimes a method may decide just to allow the exception to propogate, exceptions from things you call become part of your formal interface.

    My approach:

    1. Each layer should encapsulate its implementation details; in particular end-users should not see technical error messages
    2. Robust applications must log error symptoms to allow problem diagnosis

    Hence, in Web/Presentation tier, we catch all exceptions and display friendly messages to the user. There tend to be a small number of common scenarios:

    • The business logic layer temporarily can’t service your request (eg. DB is down), I include in this heading the unexpected, null pointers and so on, they are caused by coding errors, but they are remediated down in the business layer
    • You, mr customer, are not authorised to do that
    • Your request is invalid, it violates some business logic rule (no you can’t specify a bull-dozer attachment for your new Rolls Royce)

    I find that the UI sometimes displays the error information differently in those cases, and hence I like to distinguish them. This leads me to design my Business Logic interfaces to throw corresponding Exceptions: TransientException, AuthorisationException, InvalidRequestException.

    The InvalidRequestException tends to have useful payload to help the UI format a useful response.

    The TransientException can include technical information (like DB XXX has problenm YYY) not for display to the user, but as an aid to diagnosis in a distributed system.

    The business logic layer is responsible for catching the myriad problems from lower layers and producing the exceptions for the UI.

    The Data access layer should follow the principle of First Failure Data Capture: catch problems log the error in detail and throw some suitable exception.

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

Sidebar

Related Questions

I have a three-tier application which is installed in corporate environments. With every server
I have a three-tier Windows-based web application bundled into 3 AMIs on Amazon EC2
I have a classic 3-tier ASP.Net 3.5 web application with forms that display business
Newbie question. I'm developing a web application (I'm using Flex/AS3, but for the purposes
I have three tables. This query will write down the right answer (x-lines for
I have three fields, namely Number1 Number2 Time I am trying to write a
When I'm joining three or more tables together by a common column, I'd write
There are three columns of cost, participant, single_cost and wants to write SQL to
I have a database with three tables: user_table country_table city_table I want to write
I've got three boolean values A, B and C. I need to write an

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.