• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

planning RecordNotFoundException

 
Andy Zhu
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is my planning:

1. subclass RNFE to Exception.
2. in the place of create rnfe object, explicitly set the cause and message;
3. in the place that throws rnfe but actual cause is from some other type, e.g., IOException, still refer to 2 with different values;
4. in db server, if any catch of rnfe, just pass up and eventually client will catch it.
5. it is client's job to decode the error and decide what to do with them (may involve user's interaction and we as developer may give suggestion to user.).

Any comments? I haven't look at SecurityException, DuplicateException, but may apply the same strategy if my previous scheme stands.

Thanks very much for any input.
 
Ben Zung
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Andy. You can find lots of topics on the exception handling in this forum by doing a search on whatever you want to know.
To me, your point 1,2,4,5 seems fine but point 3 may need more discussion.
There was a topic exactly talking about it I just could not find it.

I'll post it here if I do.

Bing
[ June 01, 2004: Message edited by: Bing Yuen ]
 
Andy Zhu
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, Bing. I am very interested in the message you referred to.
 
Vishwa Kumba
Ranch Hand
Posts: 1066
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Exception chaining is a good idea. There is already a java.lang.SecurityException of type RuntimeException defined in the JDK API. I am using that in my assignment.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic