Return to try block
hello my friends, the doubt is how can I return to the try block after having treated the exception and correct the problem. For example:
catch (Exception e)
I want that my following code line allows me to back to try block, where I am doing the call of the method that through the exception
and another thing, when I do like here in the example:
CConsola.writeLine (e.getMessage ());
There should not go out the message that and I have defined in the exception?
Thank you for everything.
The answer is easy: you can not return to the try block after you do a catch
yo can visit this url
maybe you understand the concept
the whole point of a try block is that if something goes wrong in that section, you need to abort and handle things. you don't WANT to continue with that code if an exception is thrown.
If you want a line or block of code to run regardless of the exception, take it out of the try/catch/finally block.
of course, you may need to put it into its OWN try/catch, if you do not declare you will throw the exeption...