From a0ff4adbc6083ea06cbfb972bcc1d9783669b3a1 Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 20 Feb 2021 20:05:51 +0000 Subject: [PATCH] Tweaks to sentry integration Report menu item activation, and define a RAII helper for setting the XML error reporting state. --- src/GUI/FGPUIMenuBar.cxx | 5 ++++- src/Main/sentryIntegration.cxx | 28 +++++++++++++++++++--------- src/Main/sentryIntegration.hxx | 7 +++++++ 3 files changed, 30 insertions(+), 10 deletions(-) diff --git a/src/GUI/FGPUIMenuBar.cxx b/src/GUI/FGPUIMenuBar.cxx index be2dad214..5141ca916 100644 --- a/src/GUI/FGPUIMenuBar.cxx +++ b/src/GUI/FGPUIMenuBar.cxx @@ -8,9 +8,10 @@ #include #include +#include
#include
#include
-#include
+#include
#include "new_gui.hxx" #include "FGPUIMenuBar.hxx" @@ -161,6 +162,8 @@ FGPUIMenuBar::fireItem (puObject * item) vector &bindings = _bindings[name]; int nBindings = bindings.size(); + flightgear::addSentryBreadcrumb("fire menu item:" + string{item->getLabel()}, "info"); + for (int i = 0; i < nBindings; i++) bindings[i]->fire(); } diff --git a/src/Main/sentryIntegration.cxx b/src/Main/sentryIntegration.cxx index ce7520bde..782f96a90 100644 --- a/src/Main/sentryIntegration.cxx +++ b/src/Main/sentryIntegration.cxx @@ -62,15 +62,15 @@ auto OSG_messageWhitelist = { }; auto XML_messageWhitelist = { - "Cannot open file", - "not well-formed (invalid token)", - "mismatched tag", - "syntax error", - "no element found", - "Root element name is", - "XML or text declaration not at start of entity", - "Failed to open file" -}; + "Cannot open file", + "not well-formed (invalid token)", + "mismatched tag", + "syntax error", + "no element found", + "Root element name is", + "XML or text declaration not at start of entity", + "Failed to open file", + "unclosed token"}; auto exception_messageWhitelist = { "position is invalid, NaNs", ///< avoid spam when NaNs occur @@ -552,4 +552,14 @@ void addSentryTag(const std::string& tag, const std::string& value) addSentryTag(tag.c_str(), value.c_str()); } +SentryXMLErrorSupression::SentryXMLErrorSupression() +{ + sentryThreadReportXMLErrors(false); +} + +SentryXMLErrorSupression::~SentryXMLErrorSupression() +{ + sentryThreadReportXMLErrors(true); +} + } // of namespace flightgear diff --git a/src/Main/sentryIntegration.hxx b/src/Main/sentryIntegration.hxx index 169a010e1..231c5a3f8 100644 --- a/src/Main/sentryIntegration.hxx +++ b/src/Main/sentryIntegration.hxx @@ -56,5 +56,12 @@ void sentryReportFatalError(const std::string& msg, const std::string& more = {} */ void sentryThreadReportXMLErrors(bool report); +class SentryXMLErrorSupression +{ +public: + SentryXMLErrorSupression(); + ~SentryXMLErrorSupression(); +}; + } // of namespace flightgear