Can I use uncaughtexceptionhandler to ignore the exception and move forward? If I can, how to write that handler?
for example:
try{
//something
}catch(exception e){
//something
}
//AND WHEN SOME UNCAUGHT EXCEPTION APPEAR, IGNORE EXCEPTION AND MOVE TO NEXT STEP
try{
//something else
}catch(exception e){
//something else
}
thank you for your attention
You can use the
try .. (catch) .. finallyconstruct to execute code even if an exception was thrown but not handled.if you add a
catchin there then execution order istryup to the point where the exception happened, then the first appropriatecatchblock, then thefinallyblock.If you want to execute code in the finally block only if there was no exception, set some flag as the last operation of the
tryblock.Note: if you don't
catchan otherwise uncaught exception somewhere your app will still crash after it has exectued the code infinally.