Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • 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: 17278
6
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic