When an exception occurs, although I inform the user, I print out the exception to the console as that could help in the future to debug. Whats the best way, exp.printStackTrace() or just System.out.println(exp);
Never be satisfied with anything less than the best and you will surely pass the test...
I think it depends. If you know exactly what exception it goanna throw use System.out.println(e) to see it. If you are using generic type to catch an exception, but you are not sure what goanna be caught? You bet, e.printStackTrace(); gives clear picture. Any additions on this are welcome. -Bal
Originally posted by Kalichar Rangantittu: When an exception occurs, although I inform the user, I print out the exception to the console as that could help in the future to debug. Whats the best way, exp.printStackTrace() or just System.out.println(exp);
Hi How should we handle the exceptions ? Catch it re-throw it , wrap it up a application specific message so that it is shown as a user-friendly message on the client GUI or would it be better to incorporate soething like a logger instead of using a S.O.P or printStackTrace. Thanks -- ravindra
My advice is to do not print anything... ...exception means something wrong in your assignment which must be perfect ...JUST KIDDING More seriously, as it is not mention in the assignment to implement a log. I think a System.out.println is enough.
I think I actually made sure that all exceptions got rethrown to either the CLients GUI, if it's something on their side, or somthing about the Server that they should know about, like they couldn't access the Data file. Then the others got passed up to the Server GUI, kind of like, Hey I can't bind the Object because it is Null. Therefore there wasn't any e.printStackTrace() calls or such. At least once the GUI's were up. It might have one in the server just before the GUI starts, and therefore I ahve to put it there. Mark