• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception Handling and Purpose

 
Javini Javono
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I'll have to do more reading and review of this topic, both at this web site
and from my books. But, in the interrum, here is my question.
First, the code:

As an example, you'll see one portion where three exceptions are potentially
caught: notBoundException, malformedUrlException, remoteException.
From my perspective, all I care about as "the running application" is that I
was not able to connect to the "local" or remote server. That is, from the
perspective of "the running application," whether the exception was any one of
these potential three types is not relevant.
Should I also be concerned about the user? That is, should the exception message
offer hints to the user about how to get the application to operate correctly?
Such as:

Thanks,
Javini Javono
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, yes you do wnat to be concerned about the client. Most importantly that they know something happened. Secondly, wrapping each into a new ApplicationException type exception so that the client only has to catch one exception is very good. Just like you have.
I will say that I am more impressed by the second set of exception handling. It is cool to let the client know some possible remedies. Not necessarily needed for the assignment, but that won't hurt, and if you keep that practice up, very good for the real world.
Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic