Sentry: only report METAR parse failures once per session.
This commit is contained in:
parent
8e90e4657f
commit
009d86e7a6
1 changed files with 7 additions and 1 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue