• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception over RMI

 
Yupp Cook
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!
In general it is better to throw Exceptions instead of returning error codes. But how's that when calling a RMI-method. Would that still be bad practice?
Yupp
 
Saheed Adepoju
Ranch Hand
Posts: 267
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
Well, Returning error codes is definately a bad practice any time. Then the reason Exception classes were created would be defeated. About the remote Exceptions, there exists RemoteExceptions that can be thrown within your code, so i dont think throwing error codes would be a good idea. It is totally a bad practice.
 
Kevin Conaway
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Clients should not have to deal with a RemoteException. A RemoteException (or an IOException, SQLException, etc) should be chained to some business-specific exception like RecordUnavailableException.

You never want to expose clients to the inner-workings of your code. They don't care that a RemoteException was thrown, they care that they can't read the record or whatever.

Kevin
[ March 02, 2006: Message edited by: Kevin Conaway ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic