• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

When to catch RecordNotFoundException and what to display for RemoteException

 
Bartender
Posts: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 192
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 3648
16
Android Mac OS X Firefox Browser Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).
 
reply
    Bookmark Topic Watch Topic
  • New Topic