1
0
Fork 0

Sentry: only report METAR parse failures once per session.

This commit is contained in:
James Turner 2021-06-26 16:25:33 +01:00
parent 8e90e4657f
commit 009d86e7a6

View file

@ -124,12 +124,18 @@ void LiveMetarProperties::handleMetarData( const std::string & data )
_timeToLive = DEFAULT_TIME_TO_LIVE_SECONDS; _timeToLive = DEFAULT_TIME_TO_LIVE_SECONDS;
SGSharedPtr<FGMetar> m; SGSharedPtr<FGMetar> m;
static bool haveReportedMETARFailure = false;
try { try {
m = new FGMetar(data.c_str()); m = new FGMetar(data.c_str());
} }
catch( sg_io_exception &) { catch( sg_io_exception &) {
SG_LOG( SG_ENVIRONMENT, SG_WARN, "Can't parse metar: " << data ); SG_LOG( SG_ENVIRONMENT, SG_WARN, "Can't parse metar: " << data );
flightgear::sentryReportException("Failed to parse live METAR", data);
// ensure we only report one METAR parse failure per session
if (!haveReportedMETARFailure) {
haveReportedMETARFailure = true;
flightgear::sentryReportException("Failed to parse live METAR", data);
}
_failure = true; _failure = true;
return; return;
} }