suppose am in the middle of updating some information and the network connection goes off.
How should i write my code to handle such situation and resume from where the code was last executing?
One possible approach i could think of is to catch the exeception. and redo the logic again.
While(NetworkProblem){
NetworkProblem = false; try{
//step 1 - Reading info from db //step 2 - storing on class objects //step 3 - updating info //step 4 - connecting to another webserver //step 5 - update info
}catch(NetworkgoneException){
NetworkProblem = true;
// try to connect again - this again i dont know how long will take.
}
}