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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T01:49:24+00:00 2026-06-04T01:49:24+00:00

When is it justified to create a new exception. Is there some kind of

  • 0

When is it justified to create a new exception. Is there some kind of checklist with conditions to be met before it is a good design decision to make a new exception type with respects to the .Net framework?

For example consider:

You have a class with a method that return an integer that is not critical to be completed by the consumer of the method but provide some extra information. There are various things that could go wrong in the method that does not depend on how the user of the class calls this method. Let say one is that network connection could be lost and the other is that the API of the web service the method is trying to call changed. The consumer of the method do not have the ability to handle these cases differently to try recover from the exception. Should there be two different exceptions for these operations or a more general exception (say for example CommunicationFailureException) covering both these cases with a specific description and inner exception? Or should the .Net exceptions be thrown that was originally thrown when the method failed to call into the web service?

I would appreciate more to know the principles for creating a new exception type rather than something to just cover this specific example.

  • 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-06-04T01:49:26+00:00Added an answer on June 4, 2026 at 1:49 am

    Create a new exception type when you have something additional to say about the exception – something that is not covered by the existing exceptions.

    If your application has some specific invariants and you need to communicate they are invalid – that may be a good place for a custom exception type. This allows you to catch exceptions that are specific to your application.

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

Sidebar

Related Questions

I want to have a left justified label with some bold text in it,
How to make text in flex justified (text-align option)
I'm attempting to create a table with the first cell left justified, and all
I received some justified critical feedback on my last question ( How to gracefully
I need the cursor justified to the left. For some reason its indented when
I am researching possibilities to create project templates for the kind of projects my
Is it possible? Align the text fully justified? Does anyone know any hack or
I would like to create a rather plain, but attractive clock stylable with css
To let JavaScript able to run in server-side? If it's justified, what's the advantage?
How can I make my entire LaTeX document (using TeXShop in Mac OS X)

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.