• Post Reply Bookmark Topic Watch Topic
  • New Topic

throwing exceptions

 
Andrew Collins
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi folks,
In my remote implementation of DataInterface I have a method :
public void lock(int record) throws RemoteException,IOException{
...
}
Although RemoteException IS an IOException I explicitly stated it because I find that the client programmer should be able to distinct network troubles from an invalid record number.
Is this bad practice ? I mean, should I just throw an IOException and achieve the ability to distinct the causes in some other way ?
Thanks
A
 
Mark Spritzler
ranger
Sheriff
Posts: 17309
11
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How about throwing RemoteException and DatabaseException
RemoteException will handle that IO stuff,
and DatabaseException will handle invalid record number stuff.
Mark
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!