On 09/05/2016 08:07 PM, pineapple wrote:
try{
do_a_thing();
}catch(Exception exception){
handle_error();
}else{
depends_on_success_of_thing();
}finally{
do_this_always();
}
Would be equivalent to
bool success = false;
try{
do_a_thing();
success = true;
}catch(Exception exception){
handle_error();
}finally{
try{
if(success){
depends_on_success_of_thing();
}
}finally{
do_this_always();
}
}
Can you point out how this is different from (and better than)
try { do_a_thing(); depends_on_success_of_thing(); }
catch (...) { ... }
finally { ... }
?