Skip to content

Instantly share code, notes, and snippets.

@premkumr
Last active August 29, 2015 13:57
Show Gist options
  • Save premkumr/9746773 to your computer and use it in GitHub Desktop.
Save premkumr/9746773 to your computer and use it in GitHub Desktop.
Try catch around all network calls
// 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