• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

When to catch RecordNotFoundException and what to display for RemoteException

 
K. Tsang
Bartender
Posts: 3583
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all, I have a services layer in between my client GUI and RMI server. Currently, I catch the RecordNotFoundException in my services layer. Now if I run the network mode and do a search say, if there are NO results, the error popup is displayed on my server side ... this it will make my client hang not knowing what hit him/her.

Should I also throw RecordNotFoundException in my services layer and catch them in the client code instead. I think this is the easiest way to go. Or should I create some form of exception wrapper say UserException then in my services layer when I catch RecordNotFoundException, I will throw UserException("bla bla").

My services layer has methods like search and book that throws RemoteException.

Also for RemoteException, should I display the getMessage() from RemoteException to the client eg re.getMessage()?? Because there can be so many forms of RemoteException.

Thanks all.
 
Kevin Florish
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wrap my RecordNotFoundExceptions etc in a ServicesException in the services layer. I then use a handleException method to display the message
in an alert window. After this the program will end if it is a Severe error or continue where possible when the alert window is closed.

With remote exceptions I wrap ServicesException , NotBoundException and MalformedURLException exceptions into a RemoteException with some
meaningful information along with the remote exception message and do as above.
 
K. Tsang
Bartender
Posts: 3583
16
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Kevin for your input. After some thought I will wrap the RecordNotFoundException etc. This way it will potentially solve the concurrent client update problem (eg outdated data).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic