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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:39:05+00:00 2026-05-15T05:39:05+00:00

i have some business logic that traps some logically invalid situations, e.g. trying to

  • 0

i have some business logic that traps some logically invalid situations, e.g. trying to reverse a transaction that was already reversed. In this case the correct action is to inform the user:

Transaction already reversed

or

Cannot reverse a reversing transaction

or

You do not have permission to reverse transactions

or

This transaction is on a session that has already been closed

or

This transaction is too old to be reversed

The question is, how do i communicate these exceptional cases back to the calling code, so they can show the user?

Do i create a separate exception for each case:

catch (ETransactionAlreadyReversedException)
    MessageBox.Show('Transaction already reversed')
catch (EReversingAReversingTransactionException)
    MessageBox.Show('Cannot reverse a reversing transaction')
catch (ENoPermissionToReverseTranasctionException)
    MessageBox.Show('You do not have permission to reverse transactions')
catch (ECannotReverseTransactionOnAlredyClosedSessionException)
    MessageBox.Show('This transaction is on a session that has already been closed')
catch (ECannotReverseTooOldTransactionException)
    MessageBox.Show('This transaction is too old to be reversed')

Downside for this is that when there’s a new logical case to show the user:

Tranasctions created by NSL cannot be reversed

i don’t simply show the user a message, and instead it leaks out as an unhandled excpetion, when really it should be handled with another MessageBox.

The alternative is to create a single exception class:

`EReverseTransactionException`

With the understanding that any exception of this type is a logical check, that should be handled with a message box:

catch (EReverseTransactionException)

But it’s still understood that any other exceptions, ones that involve, for example, an memory ECC parity error, continue unhandled.

In other words, i don’t convert all errors that can be thrown by the ReverseTransaction() method into EReverseTransactionException, only ones that are logically invalid cause of the user.

  • 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-15T05:39:06+00:00Added an answer on May 15, 2026 at 5:39 am

    I find that there are various broad categories of exception:

    1. TransientException – what you just tried didn’t work, but if your try again it might. Used for cases such as Database not currently available.
    2. InvalidRequestException – you just asked for something that can’t be done (Your examples fit here)
    3. SystemException – The system is sick, we’ve forgotten everything you just said, your session is dead, you need to start all over again.

    I would have these three main types of exception and catch each of them, there being obvious specific actions in each case. All my exceptions derive from these three types.

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

Sidebar

Related Questions

Consider this scenario. I have some business logic that now and then will be
I have a library that I created with some business logic that includes writing
I am creating a series of UserControls that all have some similar business logic.
I have a service object that is responsible for some business logic validation. What
Let's say you have a business logic method that can perform some operation across
Generally We have some business logic that is causing a bottle neck within a
I have some functions that work on strings for some business logic. Should I
I have a function get_non_open_deals() that contains some business logic, that is used both
In our case we have some business logic that looks into several tables in
I have a servlet that does some business login and then redirects to a

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.