Question 114


4.2.1 Question

Multiple Choice

You are re-creating an application that was originally built with ASP 2.0. You need to break the monolithic application into a traditional three-tier application. One of the requirements is that database errors must be displayed in the UI. Which solution will present enough information to the user so they can notify the appropriate person of a problem, but not allow the user to gain information about the design of the database?

  • A. Add a first chance exception handler and log the information in the error.
  • B. Add a generic database-layer exception handler to the business layer, and pass appropriate error information to the UI layer for display in a custom error page.
  • C. Add specific database exception handlers in the business layer and log the information into the database for further review.
  • D. Let the errors pass through the business layer to the UI layer where they can be handled as specific errors and presented as appropriate in the UI.

Answer:

B
Explanation
A. Incorrect: Although logging information is an important consideration, it does not provide additional information to the users.
B. Correct: The business layer is the appropriate place to manage data layer excep­tions. By repackaging it and sending it up to the user layer, you can maintain separation of concerns and meet the requirement to display information to the user. This will also enable you to log the information as necessary to support de­bugging.
C. Incorrect: You are having the business layer handle the database exception cor­rectly, but you are not meeting the requirement to provide information about the error to the user.
D. Incorrect: By not having the business layer capture and handle the error, you are building an improper relationship between the UI and the database.