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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:01:40+00:00 2026-05-24T16:01:40+00:00

I am designing a Framework library which can be used to store a hierarchically

  • 0

I am designing a Framework library which can be used to store a hierarchically linked set of objects. I need to decide on what exceptions can be thrown by the following methods:

class StoreSession {
  StoreLeaf(leaf, parent)
}

When users call StoreLeaf() passing the params and if the leaf is not hierarchically linked to a parent based on some custom rules that I execute, then I need to throw an exception (something like InvalidParentException)

If the object that I am attempting to store already has an entry in the repository, then I also need to throw an exception (something like ObjectAlreadyPresentException)

I referred the FDG and also here, there are no instances of any exceptions that describe these 2 scenarios.

Is there any .NET exception that describes these erroneous conditions? Or even If I have to create a new Exception type, is there any specific .NET exception that I can derive from?

  • 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-24T16:01:42+00:00Added an answer on May 24, 2026 at 4:01 pm

    No, there isn’t any specific .NET Exception that describes these conditions; if there were, they would probably be specific to a data structure that fits your needs and you would be using that instead of writing your own.

    That said, when the framework first came out, the initial recommendation was to derive from ApplicationException, however, it was quickly revealed that lead to quite a bit of bloat and was ineffective, so the current practice is to derive custom exceptions directly from Exception.

    However, in your specific case, unless there is an action item you are planning on taking in the face of these exceptions, you should probably just use InvalidOperationException.

    If you are going to perform an action on these exceptions, then you might want to consider whether or not you should use exceptions at all; it’s generally bad practice to base business logic off exceptions; you should use return codes/values where possible.

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

Sidebar

Related Questions

I'm designing a networking framework which uses WSAEventSelect for asynchronous operations. I spawn one
I'm designing a Framework which I want to attach to the scripting language API
I'm currently designing a windows mobile application using compact framework 3.5 and I need
I am designing a simple internal framework for handling time series data. Given that
I am designing a web application using the ASP.net MVC framework. I would like
I'm wondering how you'd recommend designing a class, given the fact that XNA Framework
Okay, so I'm designing a stand-alone web service (using RestLET as my framework). My
Designing a new system from scratch. I'll be using the STL to store lists
Im designing a MVC framework but I dont know where should I put my
I am working on a PHP framework and am currently designing error handling. Based

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.