1
0
Fork 0

Tweaks to sentry integration

Report menu item activation, and define a RAII helper for setting
the XML error reporting state.
This commit is contained in:
James Turner 2021-02-20 20:05:51 +00:00
parent c85916d88d
commit a0ff4adbc6
3 changed files with 30 additions and 10 deletions

View file

@ -8,9 +8,10 @@
#include <simgear/structure/SGBinding.hxx> #include <simgear/structure/SGBinding.hxx>
#include <simgear/props/props_io.hxx> #include <simgear/props/props_io.hxx>
#include <Main/fg_props.hxx>
#include <Main/globals.hxx> #include <Main/globals.hxx>
#include <Main/locale.hxx> #include <Main/locale.hxx>
#include <Main/fg_props.hxx> #include <Main/sentryIntegration.hxx>
#include "new_gui.hxx" #include "new_gui.hxx"
#include "FGPUIMenuBar.hxx" #include "FGPUIMenuBar.hxx"
@ -161,6 +162,8 @@ FGPUIMenuBar::fireItem (puObject * item)
vector<SGBinding *> &bindings = _bindings[name]; vector<SGBinding *> &bindings = _bindings[name];
int nBindings = bindings.size(); int nBindings = bindings.size();
flightgear::addSentryBreadcrumb("fire menu item:" + string{item->getLabel()}, "info");
for (int i = 0; i < nBindings; i++) for (int i = 0; i < nBindings; i++)
bindings[i]->fire(); bindings[i]->fire();
} }

View file

@ -69,8 +69,8 @@ auto XML_messageWhitelist = {
"no element found", "no element found",
"Root element name is", "Root element name is",
"XML or text declaration not at start of entity", "XML or text declaration not at start of entity",
"Failed to open file" "Failed to open file",
}; "unclosed token"};
auto exception_messageWhitelist = { auto exception_messageWhitelist = {
"position is invalid, NaNs", ///< avoid spam when NaNs occur "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()); addSentryTag(tag.c_str(), value.c_str());
} }
SentryXMLErrorSupression::SentryXMLErrorSupression()
{
sentryThreadReportXMLErrors(false);
}
SentryXMLErrorSupression::~SentryXMLErrorSupression()
{
sentryThreadReportXMLErrors(true);
}
} // of namespace flightgear } // of namespace flightgear

View file

@ -56,5 +56,12 @@ void sentryReportFatalError(const std::string& msg, const std::string& more = {}
*/ */
void sentryThreadReportXMLErrors(bool report); void sentryThreadReportXMLErrors(bool report);
class SentryXMLErrorSupression
{
public:
SentryXMLErrorSupression();
~SentryXMLErrorSupression();
};
} // of namespace flightgear } // of namespace flightgear