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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T10:42:55+00:00 2026-06-01T10:42:55+00:00

Instead of throwing new Exception(Some message, maybeSomeCause) , which means that all callers of

  • 0

Instead of throwing new Exception("Some message", maybeSomeCause), which means that all callers of my method will need to catch Exception (which can include RuntimeExceptions), I’d like to throw a more specific type of exception when a problem occurs.

I can create my own exception types which extend Exception or another exception type, but I am curious if it is a good idea to re-use some exceptions that come with core Java language, such as:

  • IllegalArgumentException
  • UnsupportedOperationException
  • IOException
  • Others?

Are there others that I am missing? I found a basic list of the ‘core’ exceptions here: http://rymden.nu/exceptions.html, with humous explanations.

Thanks!

Edit:

Is there a good list of ‘core’ exceptions?

List so far:

  • http://rymden.nu/exceptions.html
  • Java 7 Exception class API
  • 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-01T10:42:57+00:00Added an answer on June 1, 2026 at 10:42 am

    Yes, it’s very good to do that. In fact, it’s even written about in Effective Java, 2nd ed. See item 60 on page 248: “Favor the use of standard exceptions”

    Reusing preexisting exceptions has several benefits. Chief among
    these, it makes your API easier to learn and use because it matches
    established conventions with which programmers are already familiar. A
    close second is that programs using your API are easier to read
    because they aren’t cluttered with unfamiliar exceptions. Last (and
    least), fewer exception classes mean a smaller memory footprint and
    less time spent loading classes.

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

Sidebar

Related Questions

When is it appropriate to use a ThrowHelper method instead of throwing directly? void
Here's my problem (for en-US): Decimal.Parse(1,2,3,4) returns 1234, instead of throwing an InvalidFormatException. Most
Instead of absolutely positioning (I have to do that, don't ask why) elements over
Instead of scaling, which I think pinch gesture is usually used for, I am
Instead of a clustered: - (void)objectLoader:(RKObjectLoader *)objectLoader didLoadObjects:(NSArray *)objects { if (objectLoader.method == RKRequestMethodGET)
I have a fluent validation API that throws an exception when a supplied boolean
This MSDN page mentions that there're nothrow versions of new and delete . nothrow
Is it a bad idea to use exception chaining when throwing RemoteExceptions? We have
How to wait for garbage collector instead throwing OutOfMemoryError by JVM? Is there is
The Problem I'm running multiple invocations of some external method via an ExecutorService .

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.