This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
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.