Last active
August 29, 2015 13:57
-
-
Save premkumr/9746773 to your computer and use it in GitHub Desktop.
Try catch around all network calls
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// att & atc are defined in Netsession.h | |
try { | |
netDataPathClientSession *sessionCtx = getClientSession<> ... (); ... | |
boost::shared_ptr<FDSP_DataPathReqClient> client = sessionCtx->getClient(); | |
client->GetObject or any network call | |
} catch(const att::TTransportException& e) { | |
LOGERROR << "error during network call : " << e.what(); | |
} | |
// if you are tracking the error countt | |
if (errcount >= int(ceil(numNodes*0.5))) { | |
LOGCRITICAL << "Too many network errors : " << errcount ; | |
return ERR_NETWORK_TRANSPORT; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment