What is the use of rethrowing checked and unchecked exceptions?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you want to execute some code when a problem happens without hiding the problem.
For example, let’s say you want to rollback changes if an exception occurs while writing to a database:
If you use this code, the calling function will never find out that an exception occurred.
Instead, you should write