• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Questions about Exceptions Handling

 
Mike Tilling
Ranch Hand
Posts: 86
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

1- Can I throw the same custom exception (say ServerInternalException) when RemoteException or InterruptedException are thrown ?

2- How do I recover the RemoteException (Do I stop both Client and Server applications)?

3- same question for IOException
4- Same question for the InterruptedException?

5-When creating custom excptions, is it better to subclass from the RuntimeException class or the Exception class

BestRegards
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 11867
194
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mike,

Before answering any of these questions, I think you need to ask yourself:
  • When will these exceptions be thrown?


  • Who will be throwing them?


  • What do I want to have happen in response to those events?
  • Once you have some answers to those questions, you may find that the questions you asked may be redundant, or may need to be reworded.

    I know I haven't really answered your question, but it is deliberate - you will be a better programmer if you can sit down and work through this yourself.

    Please do your thinking out loud (that is - as you think about the questions I have raised, feel free to put your thoughts in this post).

    Regards, Andrew
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic