• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Remote exception handling

 
Charles Dupin
Ranch Hand
Posts: 94
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To send the database exceptions to the client should I code this:

or should I add the DatabaseException to the signature of the methods in the stub remote implementation and interface.
Thanks
Charles.
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The second. A RemoteException is problem in the RMI transport mechanism. It is no coincidence that RemoteException is a subclass of IOException.
A DatabaseException, on the other hand, has (usually) nothing to do with I/O, let alone RMI. In other words, DatabaseException IS-NOT-A RemoteException. Making it a subclass of RemoteException is therefore a venial sin against OOD hygiene, perhaps even a mortal one.
- Peter
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic