From c4a7b15d6491ba195d44ed12420e6a9503add6df Mon Sep 17 00:00:00 2001 From: Lorenzo Blasa Date: Tue, 2 Apr 2024 11:02:45 -0700 Subject: [PATCH] Fix OSS build for unavailable Folly type Summary: Very recently this catch was added to guard against instances which may yield a malformed json. Unfortunately, the change requires a newer version of Folly which is not used in OSS. Reviewed By: antonk52 Differential Revision: D55637338 fbshipit-source-id: 1a3ba3ce3c2bb8c9f93eddb069bfadd6b45cafe7 --- xplat/Flipper/FlipperConnectionManagerImpl.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/xplat/Flipper/FlipperConnectionManagerImpl.cpp b/xplat/Flipper/FlipperConnectionManagerImpl.cpp index 4f3c21dcd22..a427b794320 100644 --- a/xplat/Flipper/FlipperConnectionManagerImpl.cpp +++ b/xplat/Flipper/FlipperConnectionManagerImpl.cpp @@ -330,8 +330,12 @@ void FlipperConnectionManagerImpl::sendMessage(const folly::dynamic& message) { // Skip sending messages that are too large. log(e.what()); return; - } catch (json::print_error& e) { - // Skip sending messages with invalid K/V + } catch (std::runtime_error& e) { + // Skip sending messages with invalid K/V. + // On newer versions of folly, this will throw a json::print_error. + // Because we are using an older version of folly, we need to catch + // the more generic std::runtime_error which is the base class for + // json::print_error. log(e.what()); return; }