Allow steps to fail with error message

Summary:
Add a method to add error messages into failed steps. This will be surfaced in the diagnostic screen, to help the user
troubleshoot.

Reviewed By: passy

Differential Revision: D9333322

fbshipit-source-id: 5f1e55c3d71b19292dbc428aaecfbd41e7a75125
This commit is contained in:
John Knox
2018-08-15 06:03:09 -07:00
committed by Facebook Github Bot
parent dfcfa9f7fa
commit 38391ca29e
4 changed files with 15 additions and 5 deletions

View File

@@ -123,19 +123,23 @@ void SonarWebSocketImpl::startSync() {
doCertificateExchange();
return;
}
connectSecurely();
connectSecurely();
connect->complete();
} catch (const folly::AsyncSocketException& e) {
if (e.getType() == folly::AsyncSocketException::NOT_OPEN) {
// The expected code path when flipper desktop is not running.
// Don't count as a failed attempt.
connect->fail("Port not open");
} else {
SONAR_LOG(e.what());
failedConnectionAttempts_++;
connect->fail(e.what());
}
reconnect();
} catch (const std::exception& e) {
SONAR_LOG(e.what());
connect->fail(e.what());
failedConnectionAttempts_++;
reconnect();
}