From f72e6e0f5e66d6325380d6b160e02457ad6e88fb Mon Sep 17 00:00:00 2001 From: John Knox Date: Thu, 26 Sep 2019 07:00:10 -0700 Subject: [PATCH] Isolate background plugin initialization Summary: Background plugins are initialised when flipper connects. But there's no isolation, so if any fail to initialize, then we don't carry on initializing the rest. This fixes that by skipping failed ones only. Reviewed By: passy Differential Revision: D17600854 fbshipit-source-id: 2ef04cbcecda78ca448c2f4d56639ba63792e2f7 --- xplat/Flipper/FlipperClient.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/xplat/Flipper/FlipperClient.cpp b/xplat/Flipper/FlipperClient.cpp index 49d1a08f1..cfba8ab26 100644 --- a/xplat/Flipper/FlipperClient.cpp +++ b/xplat/Flipper/FlipperClient.cpp @@ -102,9 +102,15 @@ void FlipperClient::startBackgroundPlugins() { ++it) { std::cout << it->first << std::endl; if (it->second.get()->runInBackground()) { - auto& conn = connections_[it->first]; - conn = std::make_shared(socket_.get(), it->first); - it->second.get()->didConnect(conn); + try { + auto& conn = connections_[it->first]; + conn = + std::make_shared(socket_.get(), it->first); + it->second.get()->didConnect(conn); + } catch (std::exception& e) { + log("Exception starting background plugin: " + it->first + ". " + + e.what()); + } } } }