-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception handling #5
Comments
I don't know what exactly do you mean: a lot of methods from Java ME forces me to write them in |
Basically, Java ME forces you to do it because sometimes things can go wrong and then the program will not behave correctly. If, for example you ignore a exception thrown while saving something in your data storage, and user has a full memory, an exception might be thrown. User will not be notified about the fact that something is wrong and will be surprised to notice that the record has not been saved. Logging an exception is useful for developers but useless for the user. If an error is recoverable you should try to do so - ask user if he wants to try again or something.
Read more: http://javarevisited.blogspot.com/2013/03/0-exception-handling-best-practices-in-Java-Programming.html#ixzz4b7nH7eZj |
e.printStackTrace()
is not a proper way to handle exceptions. You can get errors because of something you haven't anticipated or hardware malfunction. Try your best to always come up with a way of properly handling exceptions. If you are 100% certain an exception is not possible to be thrown, write a comment explaining why inside of the catch block.At least that's what I've heard as a conventional way of doing this stuff.
The text was updated successfully, but these errors were encountered: