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

Unchecked Exceptions - Remote v Local ?

 
Alan Morgan
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I have created a DataException (extends RuntimeException) to catch exceptions in my data layer such as IOExceptions etc and return these to the Controller.

Now I have a RemoteDBWrapper which wraps my remote object.
It implements my DB interface (provided by Sun)
It catches RemoteExceptions thrown by the wrapped object.
Now I was wondering what to do with them.
First I was thinking create a DataException.
But then I thought why not create RemoteDataException (again extends RuntimeException) and return these to the Controller so I can tell the difference between a network problem and a data problem when they are caught in the Controller.

Anyone see problems with this approach ?
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alan,

Sending a response back to the client that did something causing the exception to be thrown is nice.

However what happens after that? Can any further work be safely performed on the server? If not, what can / should you do?

Also, what logging are you providing so that the database maintainers can later try to work out what went wrong? (Because clients often only tell you that the server crashed and expect you to fix it from that description :roll: ).

Regards, Andrew
 
Alan Morgan
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Andrew Monkhouse:
Hi Alan,

Sending a response back to the client that did something causing the exception to be thrown is nice.

However what happens after that? Can any further work be safely performed on the server? If not, what can / should you do?

Also, what logging are you providing so that the database maintainers can later try to work out what went wrong? (Because clients often only tell you that the server crashed and expect you to fix it from that description :roll: ).

Regards, Andrew



I reckon if there's a RemoteException then no there probably can't be any further work done.
I'm thinking if that happens then the application should be shut down with an appropriate error message presented to the user and any details about it logged.

In terms of logging for DB maintainers...all DB actions are logged so there should be a full trace of what was happening right up until time error occured.

Is this sufficient ?
 
Andrew Monkhouse
author and jackaroo
Marshal Commander
Pie
Posts: 12014
220
C++ Firefox Browser IntelliJ IDE Java Mac Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alan,

Sounds good.

Regards, Andrew
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic