Sentry: don't catch cmd-line aircraft init failures
Only worry about mis-config which occur when using the launcher, since basically all non-launcher ones look to be user errors.
This commit is contained in:
parent
fc40caf40e
commit
20155df3f6
3 changed files with 25 additions and 6 deletions
|
@ -198,6 +198,11 @@ public:
|
||||||
_cache = autoSave->getNode("sim/startup/path-cache", true);
|
_cache = autoSave->getNode("sim/startup/path-cache", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setDidUseLauncher(bool didUseLauncher)
|
||||||
|
{
|
||||||
|
_didUseLauncher = didUseLauncher;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief haveExplicitAircraft - check if the combination of /sim/aircraft
|
* @brief haveExplicitAircraft - check if the combination of /sim/aircraft
|
||||||
* and /sim/aircraft-dir defines an explicit -set.xml. We need to detect
|
* and /sim/aircraft-dir defines an explicit -set.xml. We need to detect
|
||||||
|
@ -292,7 +297,10 @@ public:
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT, "\tin paths:" << SGPath::join(globals->get_aircraft_paths(), ";"));
|
SG_LOG(SG_GENERAL, SG_ALERT, "\tin paths:" << SGPath::join(globals->get_aircraft_paths(), ";"));
|
||||||
|
|
||||||
std::string notFoundMessage;
|
std::string notFoundMessage;
|
||||||
bool reportToSentry = true;
|
// don't report failures where the launcher was not used, to Sentry,
|
||||||
|
// since they are nearly all configuration problems.
|
||||||
|
bool reportToSentry = _didUseLauncher;
|
||||||
|
|
||||||
if (globals->get_aircraft_paths().empty()) {
|
if (globals->get_aircraft_paths().empty()) {
|
||||||
notFoundMessage = "The requested aircraft (" + aircraft + ") could not be found. No aircraft paths are configured.";
|
notFoundMessage = "The requested aircraft (" + aircraft + ") could not be found. No aircraft paths are configured.";
|
||||||
reportToSentry = false; // no need to log these
|
reportToSentry = false; // no need to log these
|
||||||
|
@ -445,7 +453,8 @@ private:
|
||||||
|
|
||||||
std::string _searchAircraft;
|
std::string _searchAircraft;
|
||||||
SGPath _foundPath;
|
SGPath _foundPath;
|
||||||
SGPropertyNode* _cache;
|
SGPropertyNode* _cache = nullptr;
|
||||||
|
bool _didUseLauncher = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
@ -758,7 +767,7 @@ void fgInitAircraftPaths(bool reinit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int fgInitAircraft(bool reinit)
|
int fgInitAircraft(bool reinit, bool didUseLauncher)
|
||||||
{
|
{
|
||||||
if (!reinit) {
|
if (!reinit) {
|
||||||
auto r = flightgear::Options::sharedInstance()->initAircraft();
|
auto r = flightgear::Options::sharedInstance()->initAircraft();
|
||||||
|
@ -767,6 +776,7 @@ int fgInitAircraft(bool reinit)
|
||||||
}
|
}
|
||||||
|
|
||||||
FindAndCacheAircraft f(globals->get_props());
|
FindAndCacheAircraft f(globals->get_props());
|
||||||
|
f.setDidUseLauncher(didUseLauncher);
|
||||||
const bool haveExplicit = f.haveExplicitAircraft();
|
const bool haveExplicit = f.haveExplicitAircraft();
|
||||||
|
|
||||||
SGSharedPtr<Root> pkgRoot(globals->packageRoot());
|
SGSharedPtr<Root> pkgRoot(globals->packageRoot());
|
||||||
|
@ -1367,7 +1377,7 @@ void fgStartNewReset()
|
||||||
|
|
||||||
fgGetNode("/sim")->removeChild("aircraft-dir");
|
fgGetNode("/sim")->removeChild("aircraft-dir");
|
||||||
fgInitAircraftPaths(true);
|
fgInitAircraftPaths(true);
|
||||||
fgInitAircraft(true);
|
fgInitAircraft(true, false /* not from launcher */);
|
||||||
|
|
||||||
render = new FGRenderer(composite_viewer);
|
render = new FGRenderer(composite_viewer);
|
||||||
render->setEventHandler(eventHandler);
|
render->setEventHandler(eventHandler);
|
||||||
|
|
|
@ -54,7 +54,14 @@ int fgInitConfig ( int argc, char **argv, bool reinit );
|
||||||
|
|
||||||
void fgInitAircraftPaths(bool reinit);
|
void fgInitAircraftPaths(bool reinit);
|
||||||
|
|
||||||
int fgInitAircraft(bool reinit);
|
/**
|
||||||
|
* @brief
|
||||||
|
*
|
||||||
|
* @param reinit : is this a second(+) call of the function, i.e after reset
|
||||||
|
* @param didUseLauncher : allow adjusting UI feedback if we used the launcher or not
|
||||||
|
* @return int : an Options result to indicate if we should continue, quit, etc
|
||||||
|
*/
|
||||||
|
int fgInitAircraft(bool reinit, bool didUseLauncher);
|
||||||
|
|
||||||
// log various settings / configuration state
|
// log various settings / configuration state
|
||||||
void fgOutputSettings();
|
void fgOutputSettings();
|
||||||
|
|
|
@ -711,6 +711,7 @@ int fgMainInit( int argc, char **argv )
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool didUseLauncher = false;
|
||||||
#if defined(HAVE_QT)
|
#if defined(HAVE_QT)
|
||||||
if (showLauncher) {
|
if (showLauncher) {
|
||||||
flightgear::addSentryBreadcrumb("starting launcher", "info");
|
flightgear::addSentryBreadcrumb("starting launcher", "info");
|
||||||
|
@ -718,6 +719,7 @@ int fgMainInit( int argc, char **argv )
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
didUseLauncher = true;
|
||||||
flightgear::addSentryBreadcrumb("completed launcher", "info");
|
flightgear::addSentryBreadcrumb("completed launcher", "info");
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -732,7 +734,7 @@ int fgMainInit( int argc, char **argv )
|
||||||
auto errorManager = globals->add_new_subsystem<flightgear::ErrorReporter>(SGSubsystemMgr::GENERAL);
|
auto errorManager = globals->add_new_subsystem<flightgear::ErrorReporter>(SGSubsystemMgr::GENERAL);
|
||||||
errorManager->preinit();
|
errorManager->preinit();
|
||||||
|
|
||||||
configResult = fgInitAircraft(false);
|
configResult = fgInitAircraft(false, didUseLauncher);
|
||||||
if (configResult == flightgear::FG_OPTIONS_ERROR) {
|
if (configResult == flightgear::FG_OPTIONS_ERROR) {
|
||||||
return EXIT_FAILURE;
|
return EXIT_FAILURE;
|
||||||
} else if ((configResult == flightgear::FG_OPTIONS_EXIT) ||
|
} else if ((configResult == flightgear::FG_OPTIONS_EXIT) ||
|
||||||
|
|
Loading…
Add table
Reference in a new issue