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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:59:28+00:00 2026-05-10T14:59:28+00:00

Errors that occur deep down in a data access layer or even higher up,

  • 0

Errors that occur deep down in a data access layer or even higher up, (say within ADO.net operations for example) rarely make much sense to an end user. Simply bubbling these errors up to a UI and displaying them will usually achieve nothing except frustration for an end user.

I have recently employed a basic technique for reporting errors such as this whereby I catch the error and at least add some user friendly text so that at least the end user understands what failed.

To do this I am catching an exception within each specific function (say for example a fetch function in a data access layer), then raising a new error with user friendly text about the function that has failed and probably cause, but then embedding the original exception in the new exception as the ‘inner exception’ of that new exception.

This can then occur at each layer if necessary, each consumer of the lower level function adding it’s own context to the error message, so that what reaches the UI is an increasingly user friendly error message.

Once the error reaches the UI – if necessary – it can then iterate through the nested exceptions in order to display an error message that firstly tells the user which operation failed, but also provides a bit of technical information about what actually went wrong.

e.g.

‘The list of customer names your requested could not be displayed.’

‘Obtaining the list of customers you requested failed due to an error with the database.’

‘There was an error connecting to the database when retrieving a list of customers’

‘Login failed for user xx’

My question is this: Is this horribly inefficient (all those nested exceptions)? I suspect it is not best practice so what should I be doing to achieve the same thing – or should I in fact be trying to achieve something better?

  • 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. 2026-05-10T14:59:28+00:00Added an answer on May 10, 2026 at 2:59 pm

    It is just slightly horrible.

    If you are showing an error to the end user, the user is supposed to be able to act about it. In ‘The list of customer names your requested could not be displayed.’ case, your user will just think ‘so what?’ On all of these cases, just display a ‘something bad happened’ message. You do not even need to catch these exceptions, when something goes bad, let some global method (like application_error) handle it and display a generic message. When you or your user can do something about the error, catch it and do the thing or notify the user.

    But you will want to log every error that you do not handle.

    By the way, displaying information about the errors occuring may yield to security vulnerabilities. The less the attackers know about your system, the less likely they will find ways to hack it (remember those messages like ‘Syntax error in sql statement: Select * From Users Where username=’a’; drp database;–‘…’ expected: ‘drop’ instead of ‘drp’. They do not make sites like these anymore).

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

Sidebar

Ask A Question

Stats

  • Questions 163k
  • Answers 163k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer http://blog.flexexamples.com/2007/07/26/displaying-xml-data-in-a-datagrid/ Create an XMLListCollection based on your XML and use… May 12, 2026 at 12:14 pm
  • Editorial Team
    Editorial Team added an answer You're looking for basename. The example from the PHP manual:… May 12, 2026 at 12:14 pm
  • Editorial Team
    Editorial Team added an answer If you pin the VSLauncher.exe to the taskbar (drag it… May 12, 2026 at 12:14 pm

Related Questions

I have a winform app that has tabcontrols that are 3 layers deep. I
In the j2ee applications I plan on standardizing the exception handling strategy. No more
I have a batch file that runs an SSIS job. I have no knowledge
I have several batch files that I call from a parent batch file. I

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.