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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T22:29:46+00:00 2026-05-10T22:29:46+00:00

A lot of developers say only throw exceptions in truly exceptional circumstances. One of

  • 0

A lot of developers say only throw exceptions in truly exceptional circumstances. One of these would be if an external hard drive I want to write to is not switched on (therefore not a connected/registered drive). However, there are some situations which are difficult to work out whether they are truly exceptional or not.

For example, entering a string for a folder path but it is not found. In this case, if there is any input which cannot be found (like a name in a collection which is not found), is it best to just return an error message and some action?

E.G.

public void Find(string name) {     if(Names.contains(name)     {         string s = Names.get(name);     }      if(!Names.contains(string name)     {         throw new ???Exception;     } } 

Or do something like display a popup and handle the situation gracefully?

Is it wise to throw an exception in an else or if statement? Looking at a list of code smells regarding exception handling would do me a lot of favours.

  • 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. 2026-05-10T22:29:47+00:00Added an answer on May 10, 2026 at 10:29 pm

    Generally, it works like this:

    If you can handle the situation without any interruptions, do so. (File doesn’t exist, but its input isn’t essential to continuing operation [preferences, optional configuration, etc])

    If you need user intervention, ask them. (File doesn’t exist, but you need it to continue operating)

    If it’s a problem the user can’t fix (out-of-memory, failed hardware, etc), then throw an exception.

    Each place has their own standard for the details, but I find the above to work generally.

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

Sidebar

Related Questions

A lot of people would say why u not use Visual Studio, but I
I've met a lot of developers that swear by tagging gits. Personally, I have
There are a lot of former Java developers at my company who use camel
I guess the title doesn't really say a lot, so here's the explanation. I
Say you have a scenario with a central master git repository, which developers and
Like a lot of developers, I want to make JavaScript served up by Server
I am only one person working on project - so I am developer without
Our developer environment setup tends to have a lot of moving parts with a
I am an ETL developer and I deal with a lot of data that
I'm a web developer looking to move a lot of clients to use authorize.net

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.