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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:37:35+00:00 2026-05-23T14:37:35+00:00

When throwing exceptions between multiple methods, should all methods re-throw the exception? for example

  • 0

When throwing exceptions between multiple methods, should all methods re-throw the exception? for example

Method1()
{
   Method2();
}

Method2()
{
   try
   {
      // Do something
   }
   catch
   {
      throw;
   }
}

try
{
   Method1();
}
catch
{
   // Do something about exception that was thrown from Method2()
}

Notice how in Method1(), I didn’t need to wrap Method2() in a try block, should I be?

  • 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-23T14:37:35+00:00Added an answer on May 23, 2026 at 2:37 pm

    You do not need to try, catch, and rethrow exceptions unless you have some particular reason for catching them in the first place. Otherwise, they’ll automatically get bubbled up from the lower level functions that throw them to the highest level function in your code. Essentially, you can think of them as getting “rethrown” all the way up, even though this isn’t technically what is happening.

    In fact, most of the time that you see a try/catch block written, it’s incorrect. You should not catch exceptions unless you can actually handle them. It’s utterly pointless (and in fact considered to be bad practice) to catch exceptions just to rethrow them. Do not wrap all of your code within try blocks.

    Note that by “handle them”, I mean that your code in the catch block will take some specific action based on the particular exception that was thrown that attempts to correct the exceptional condition.
    For example, for a FileNotFoundException, you might inform the user that the file could not be found and ask them to choose another one.

    See my answer here for more detail and a thorough discussion of “exception handling best practices”.

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

Sidebar

Related Questions

Possible Duplicate: throwing exceptions out of a destructor In C++ we should never throw
Throwing exceptions often follows the following pattern: if(condition) { throw exception; } you check
Several of my overriden Equals methods have started throwing Invalid Cast Exceptions - Unable
I try Request.Form.Set(k, v) but it's throwing exception Collection is read-only
Accidentally I may forget to describe some parameters or exception throwing (or something else)
I have some Java code that is throwing out of memory exceptions after running
What are the best practices to consider when catching exceptions and re-throwing them? I
The AbstractMavenMojo's execute method declares it throws two exceptions, MojoExecutionException and MojoFailureException. Throwing either
What factors dictate throwing an exception if argument is null (eg if (a is
I am having trouble with XMLTextWriter.WriteStartElement throwing an exception: System.InvalidOperationException when trying to write

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.