Improve doc and examples related to error handling

This commit is contained in:
Benjamin Sergeant 2018-10-02 12:29:14 -07:00
parent 8f5d83c5c2
commit 96903b4d25
2 changed files with 10 additions and 5 deletions

View File

@ -138,10 +138,12 @@ webSocket.setOnMessageCallback(
{
if (messageType == ix::WebSocket_MessageType_Error)
{
ss << "cmd_websocket_chat: Error ! " << error.reason << std::endl;
ss << "#retries: " << event.retries << std::endl;
ss << "Wait time(ms): " << event.waitTime << std::endl;
ss << "HTTP Status: " << event.httpStatus << std::endl;
std::stringstream ss;
ss << "Error: " << error.reason << std::endl;
ss << "#retries: " << event.retries << std::endl;
ss << "Wait time(ms): " << event.wait_time << std::endl;
ss << "HTTP Status: " << event.http_status << std::endl;
std::cout << ss.str() << std::endl;
}
}
);

View File

@ -117,7 +117,10 @@ namespace
}
else if (messageType == ix::WebSocket_MessageType_Error)
{
ss << "cmd_websocket_chat: Error ! " << error.reason;
ss << "Connection error: " << error.reason << std::endl;
ss << "#retries: " << error.retries << std::endl;
ss << "Wait time(ms): " << error.wait_time << std::endl;
ss << "HTTP Status: " << error.http_status << std::endl;
log(ss.str());
}
else