I don't think this could be possible to code. When you lose connection, it's already because the game tried to reconnect, but it wasn't possible (sometimes it can also be because the device's faulty connection, but let's consider this is not the case) to reconnect. If your attack went offline and it could not restore the connection, then everything you done would not be recorded, so it will still be the same result.
Recently came back into the newer CoC, comparing to the one I used to play a lot back in 2015. They made nice changes, and the game sure is going the right way!
About me, I should say, as always, trying to do my best!
TH 9; Clan Name: Maloclă (Co-Leader); In-game Name: Snooze33