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

  • SEARCH
  • Home
  • 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 755273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:06:39+00:00 2026-05-14T15:06:39+00:00

My question is: how would you create exception hierarchy in your application? Designing the

  • 0

My question is: how would you create exception hierarchy in your application?

Designing the architecture of an application,
from my perspective, we could have three types of exceptions:

  • the built-in (e.g.: InvalidOperationException)
  • custom internal system faults (database transaction failed on commit, DbTransactionFailedException)
  • custom business exceptions (BusinessRuleViolationException)

Class hierarchy:

  • Exception
    • MyAppInternalException
      • DbTransactionFailedException
      • MyServerTimeoutException
      • …
    • MyAppBusinessRuleViolationException
      • UsernameAlreadyExistsException
      • …

where only MyAppInternalException & MyAppBusinessRuleViolationException would be catched.

  • 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-14T15:06:39+00:00Added an answer on May 14, 2026 at 3:06 pm

    The real benefit of exception type E inheriting from type F is apparently when E is caught by a module that doesn’t specifically know what E is, but does know about F. Assuming the inheritance makes sense, the module has a reasonable hope of taking the right corrective action for an E exception, based on it being a kind of E exception.

    So I tend to class exceptions according to how they can reasonably be handled. For example, a typical business process might use something like:

    • ConfigurationException — things that can be fixed by changing a config file. E.g. config cannot be parsed or is not consistent. Appropriate response is to warn the user to fix the config (with helpful hints if possible).
    • InfrastructureException — things that can sporadically go wrong with resources outside the program’s control, like remote servers, etc. Appropriate response is often to disconnect and retry after a pause, and give up if there are too many failures.
    • DataException — things that are wrong in incoming data. An appropriate response is to log the complaint (and possibly the data) and ignore this message.

    These can be subclassed of course. But distinction at that level is often more useful to modules closer to the source of the exception. If an exception bubbles all the way to main module then there are usually only a few possible actions, and it easiest to have a one-to-one correspondence between those actions and the catch statements they respond to.

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

Sidebar

Related Questions

i want to derive from std::exception to add specific information to my log files,
I am working on an NHibernate project and have a question regarding updating transient
I know that variations on this question have been asked, but I've tried all
I have a function like this, that I would like to refactor function Myfunction(sUrl,
Exception: object references an unsaved transient instance - save the transient instance before flushing:
I have a lot of legacy code that is now a backend for a
Beginner android question. Ok, I've successfully written files. E.g. // get the file name
I see all the examples of AlarmManager being set by an Activity. My question
Project A - Web Application/Website Project B - Unit Test Application I'm familiar how
In WPF you get to call ShowDialog on a window exactly once. After that

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.