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 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

Following on from this question what would be the best way to write a
This seems like a silly question but I would really like your comments and
Question So I've recently came up with some new possible projects that would have
This question would probably apply equally as well to other languages with C-like multi-line
Quick question: Would it be a good or a bad idea to implement my
This is a bit of an open question but I would really like to
This would be a question for anyone who has code in the App_Code folder
I would (as the question states) like to make an asynchronous call, preferably using
I saw this question asked about C# I would like an answer for PHP.
Just like Carl's question over here I would like to ask you (because 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.