Add error reporting to common failure points.
Not exhaustive by far, but adds many of the common failure points witnessed on Sentry.
This commit is contained in:
parent
a0ff4adbc6
commit
caad29e7c8
9 changed files with 138 additions and 56 deletions
|
@ -21,12 +21,13 @@
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <simgear/sg_inlines.h>
|
#include <simgear/debug/ErrorReportingCallback.hxx>
|
||||||
#include <simgear/math/sg_geodesy.hxx>
|
#include <simgear/math/sg_geodesy.hxx>
|
||||||
#include <simgear/props/props_io.hxx>
|
#include <simgear/props/props_io.hxx>
|
||||||
#include <simgear/structure/exception.hxx>
|
#include <simgear/sg_inlines.h>
|
||||||
#include <simgear/structure/commands.hxx>
|
|
||||||
#include <simgear/structure/SGBinding.hxx>
|
#include <simgear/structure/SGBinding.hxx>
|
||||||
|
#include <simgear/structure/commands.hxx>
|
||||||
|
#include <simgear/structure/exception.hxx>
|
||||||
|
|
||||||
#include <Add-ons/AddonManager.hxx>
|
#include <Add-ons/AddonManager.hxx>
|
||||||
#include <Airports/airport.hxx>
|
#include <Airports/airport.hxx>
|
||||||
|
@ -74,9 +75,15 @@ public:
|
||||||
if (!loadScript.empty()) {
|
if (!loadScript.empty()) {
|
||||||
FGNasalSys* nasalSys = globals->get_subsystem<FGNasalSys>();
|
FGNasalSys* nasalSys = globals->get_subsystem<FGNasalSys>();
|
||||||
std::string moduleName = "scenario_" + _internalName;
|
std::string moduleName = "scenario_" + _internalName;
|
||||||
nasalSys->createModule(moduleName.c_str(), moduleName.c_str(),
|
bool ok = nasalSys->createModule(moduleName.c_str(), moduleName.c_str(),
|
||||||
loadScript.c_str(), loadScript.size(),
|
loadScript.c_str(), loadScript.size(),
|
||||||
nullptr);
|
nullptr);
|
||||||
|
|
||||||
|
if (!ok) {
|
||||||
|
// TODO: get the Nasal errors logged properly
|
||||||
|
simgear::reportFailure(simgear::LoadFailure::BadData, simgear::ErrorCode::ScenarioLoad,
|
||||||
|
"Failed to parse scenario Nasal");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -213,8 +220,10 @@ SGPropertyNode_ptr FGAIManager::registerScenarioFile(SGPropertyNode_ptr root, co
|
||||||
auto scenariosNode = root->getNode("/sim/ai/scenarios", true);
|
auto scenariosNode = root->getNode("/sim/ai/scenarios", true);
|
||||||
SGPropertyNode_ptr sNode;
|
SGPropertyNode_ptr sNode;
|
||||||
|
|
||||||
|
simgear::ErrorReportContext ectx("scenario", xmlPath.utf8Str());
|
||||||
|
|
||||||
// don't report XML errors while loading scenarios, to Sentry
|
// don't report XML errors while loading scenarios, to Sentry
|
||||||
flightgear::sentryThreadReportXMLErrors(false);
|
flightgear::SentryXMLErrorSupression xml;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
SGPropertyNode_ptr scenarioProps(new SGPropertyNode);
|
SGPropertyNode_ptr scenarioProps(new SGPropertyNode);
|
||||||
|
@ -246,12 +255,14 @@ SGPropertyNode_ptr FGAIManager::registerScenarioFile(SGPropertyNode_ptr root, co
|
||||||
|
|
||||||
FGAICarrier::extractCarriersFromScenario(xs, sNode);
|
FGAICarrier::extractCarriersFromScenario(xs, sNode);
|
||||||
} // of scenarios in the XML file
|
} // of scenarios in the XML file
|
||||||
} catch (std::exception&) {
|
} catch (sg_exception& e) {
|
||||||
SG_LOG(SG_AI, SG_WARN, "Skipping malformed scenario file:" << xmlPath);
|
SG_LOG(SG_AI, SG_WARN, "Skipping malformed scenario file:" << xmlPath);
|
||||||
|
simgear::reportFailure(simgear::LoadFailure::BadData, simgear::ErrorCode::ScenarioLoad,
|
||||||
|
string{"The scenario couldn't be loaded:"} + e.getFormattedMessage(),
|
||||||
|
e.getLocation());
|
||||||
sNode.reset();
|
sNode.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
flightgear::sentryThreadReportXMLErrors(true);
|
|
||||||
return sNode;
|
return sNode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -590,6 +601,7 @@ FGAIBasePtr FGAIManager::getObjectFromProperty(const SGPropertyNode* aProp) cons
|
||||||
bool
|
bool
|
||||||
FGAIManager::loadScenario( const string &id )
|
FGAIManager::loadScenario( const string &id )
|
||||||
{
|
{
|
||||||
|
simgear::ErrorReportContext("scenario", id);
|
||||||
SGPropertyNode_ptr file = loadScenarioFile(id);
|
SGPropertyNode_ptr file = loadScenarioFile(id);
|
||||||
if (!file) {
|
if (!file) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -646,7 +658,10 @@ FGAIManager::loadScenarioFile(const std::string& scenarioName)
|
||||||
{
|
{
|
||||||
auto s = fgGetNode("/sim/ai/scenarios");
|
auto s = fgGetNode("/sim/ai/scenarios");
|
||||||
if (!s) return {};
|
if (!s) return {};
|
||||||
|
|
||||||
|
// don't report XML errors while loading scenarios, to Sentry
|
||||||
|
flightgear::SentryXMLErrorSupression xml;
|
||||||
|
|
||||||
for (auto n : s->getChildren("scenario")) {
|
for (auto n : s->getChildren("scenario")) {
|
||||||
if (n->getStringValue("id") == scenarioName) {
|
if (n->getStringValue("id") == scenarioName) {
|
||||||
SGPath path{n->getStringValue("path")};
|
SGPath path{n->getStringValue("path")};
|
||||||
|
@ -657,6 +672,9 @@ FGAIManager::loadScenarioFile(const std::string& scenarioName)
|
||||||
} catch (const sg_exception &t) {
|
} catch (const sg_exception &t) {
|
||||||
SG_LOG(SG_AI, SG_ALERT, "Failed to load scenario '"
|
SG_LOG(SG_AI, SG_ALERT, "Failed to load scenario '"
|
||||||
<< path << "': " << t.getFormattedMessage());
|
<< path << "': " << t.getFormattedMessage());
|
||||||
|
simgear::reportFailure(simgear::LoadFailure::BadData, simgear::ErrorCode::ScenarioLoad,
|
||||||
|
"Failed to laod scenario XML:" + t.getFormattedMessage(),
|
||||||
|
t.getLocation());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,10 +31,13 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include <simgear/debug/ErrorReportingCallback.hxx>
|
||||||
#include <simgear/props/props_io.hxx>
|
#include <simgear/props/props_io.hxx>
|
||||||
#include <simgear/structure/subsystem_mgr.hxx>
|
|
||||||
#include <simgear/structure/exception.hxx>
|
#include <simgear/structure/exception.hxx>
|
||||||
|
#include <simgear/structure/subsystem_mgr.hxx>
|
||||||
|
|
||||||
#include <Main/fg_props.hxx>
|
#include <Main/fg_props.hxx>
|
||||||
|
#include <Main/sentryIntegration.hxx>
|
||||||
|
|
||||||
using std::vector;
|
using std::vector;
|
||||||
using simgear::PropertyList;
|
using simgear::PropertyList;
|
||||||
|
@ -189,13 +192,13 @@ void FGXMLAutopilotGroup::addAutopilotFromFile( const std::string& name,
|
||||||
SGPath config = globals->resolve_maybe_aircraft_path(path);
|
SGPath config = globals->resolve_maybe_aircraft_path(path);
|
||||||
if( config.isNull() )
|
if( config.isNull() )
|
||||||
{
|
{
|
||||||
SG_LOG
|
simgear::reportFailure(simgear::LoadFailure::NotFound, simgear::ErrorCode::AircraftSystems,
|
||||||
(
|
string{"Autopilot XML not found:"} + path, sg_location{path});
|
||||||
SG_AUTOPILOT,
|
SG_LOG(
|
||||||
SG_ALERT,
|
SG_AUTOPILOT,
|
||||||
"Cannot find property-rule configuration file '" << path << "'."
|
SG_ALERT,
|
||||||
);
|
"Cannot find property-rule configuration file '" << path << "'.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SG_LOG
|
SG_LOG
|
||||||
(
|
(
|
||||||
|
@ -206,11 +209,13 @@ void FGXMLAutopilotGroup::addAutopilotFromFile( const std::string& name,
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
SGPropertyNode_ptr configNode = new SGPropertyNode();
|
flightgear::SentryXMLErrorSupression xmlc;
|
||||||
readProperties( config, configNode );
|
|
||||||
|
|
||||||
SG_LOG(SG_AUTOPILOT, SG_INFO, "adding property-rule subsystem " << name);
|
SGPropertyNode_ptr configNode = new SGPropertyNode();
|
||||||
addAutopilot(name, apNode, configNode);
|
readProperties(config, configNode);
|
||||||
|
|
||||||
|
SG_LOG(SG_AUTOPILOT, SG_INFO, "adding property-rule subsystem " << name);
|
||||||
|
addAutopilot(name, apNode, configNode);
|
||||||
}
|
}
|
||||||
catch (const sg_exception& e)
|
catch (const sg_exception& e)
|
||||||
{
|
{
|
||||||
|
@ -221,6 +226,8 @@ void FGXMLAutopilotGroup::addAutopilotFromFile( const std::string& name,
|
||||||
"Failed to load property-rule configuration: " << config
|
"Failed to load property-rule configuration: " << config
|
||||||
<< ": " << e.getMessage()
|
<< ": " << e.getMessage()
|
||||||
);
|
);
|
||||||
|
simgear::reportFailure(simgear::LoadFailure::BadData, simgear::ErrorCode::AircraftSystems,
|
||||||
|
string{"Autopilot XML faield to load:"} + e.getFormattedMessage(), e.getLocation());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,12 +12,14 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
#include <simgear/compiler.h>
|
#include <simgear/compiler.h>
|
||||||
#include <simgear/structure/exception.hxx>
|
#include <simgear/debug/ErrorReportingCallback.hxx>
|
||||||
#include <simgear/props/props_io.hxx>
|
|
||||||
#include <simgear/misc/sg_dir.hxx>
|
#include <simgear/misc/sg_dir.hxx>
|
||||||
|
#include <simgear/props/props_io.hxx>
|
||||||
|
#include <simgear/structure/exception.hxx>
|
||||||
|
|
||||||
#include <Add-ons/AddonManager.hxx>
|
#include <Add-ons/AddonManager.hxx>
|
||||||
#include <Main/fg_props.hxx>
|
#include <Main/fg_props.hxx>
|
||||||
|
#include <Main/sentryIntegration.hxx>
|
||||||
|
|
||||||
#if defined(SG_UNIX) && !defined(SG_MAC)
|
#if defined(SG_UNIX) && !defined(SG_MAC)
|
||||||
#include "GL/glx.h"
|
#include "GL/glx.h"
|
||||||
|
@ -207,9 +209,13 @@ NewGUI::showDialog (const string &name)
|
||||||
|
|
||||||
// check we know about the dialog by name
|
// check we know about the dialog by name
|
||||||
if (_dialog_names.find(name) == _dialog_names.end()) {
|
if (_dialog_names.find(name) == _dialog_names.end()) {
|
||||||
|
simgear::reportFailure(simgear::LoadFailure::NotFound, simgear::ErrorCode::GUIDialog, "Dialog not found:" + name);
|
||||||
SG_LOG(SG_GENERAL, SG_ALERT, "Dialog " << name << " not defined");
|
SG_LOG(SG_GENERAL, SG_ALERT, "Dialog " << name << " not defined");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
flightgear::addSentryBreadcrumb("showing GUI dialog:" + name, "info");
|
||||||
|
|
||||||
_active_dialogs[name] = new FGPUIDialog(getDialogProperties(name));
|
_active_dialogs[name] = new FGPUIDialog(getDialogProperties(name));
|
||||||
fgSetString("/sim/gui/dialogs/current-dialog", name);
|
fgSetString("/sim/gui/dialogs/current-dialog", name);
|
||||||
|
|
||||||
|
@ -261,6 +267,8 @@ bool
|
||||||
NewGUI::closeDialog (const string& name)
|
NewGUI::closeDialog (const string& name)
|
||||||
{
|
{
|
||||||
if(_active_dialogs.find(name) != _active_dialogs.end()) {
|
if(_active_dialogs.find(name) != _active_dialogs.end()) {
|
||||||
|
flightgear::addSentryBreadcrumb("closing GUI dialog:" + name, "info");
|
||||||
|
|
||||||
if(_active_dialog == _active_dialogs[name])
|
if(_active_dialog == _active_dialogs[name])
|
||||||
_active_dialog = 0;
|
_active_dialog = 0;
|
||||||
delete _active_dialogs[name];
|
delete _active_dialogs[name];
|
||||||
|
|
|
@ -28,11 +28,13 @@
|
||||||
|
|
||||||
#include "FGDeviceConfigurationMap.hxx"
|
#include "FGDeviceConfigurationMap.hxx"
|
||||||
|
|
||||||
|
#include <simgear/debug/ErrorReportingCallback.hxx>
|
||||||
#include <simgear/misc/sg_dir.hxx>
|
#include <simgear/misc/sg_dir.hxx>
|
||||||
#include <simgear/props/props_io.hxx>
|
#include <simgear/props/props_io.hxx>
|
||||||
#include <simgear/structure/exception.hxx>
|
#include <simgear/structure/exception.hxx>
|
||||||
|
|
||||||
#include <Main/globals.hxx>
|
#include <Main/globals.hxx>
|
||||||
|
#include <Main/sentryIntegration.hxx>
|
||||||
#include <Navaids/NavDataCache.hxx>
|
#include <Navaids/NavDataCache.hxx>
|
||||||
|
|
||||||
using simgear::PropertyList;
|
using simgear::PropertyList;
|
||||||
|
@ -158,15 +160,21 @@ void FGDeviceConfigurationMap::readCachedData(const SGPath& path)
|
||||||
|
|
||||||
void FGDeviceConfigurationMap::refreshCacheForFile(const SGPath& path)
|
void FGDeviceConfigurationMap::refreshCacheForFile(const SGPath& path)
|
||||||
{
|
{
|
||||||
SG_LOG(SG_INPUT, SG_DEBUG, "Reading device file " << path);
|
simgear::ErrorReportContext ectx("input-device", path.utf8Str());
|
||||||
SGPropertyNode_ptr n(new SGPropertyNode);
|
|
||||||
try {
|
SG_LOG(SG_INPUT, SG_DEBUG, "Reading device file " << path);
|
||||||
readProperties(path, n);
|
SGPropertyNode_ptr n(new SGPropertyNode);
|
||||||
} catch (sg_exception&) {
|
flightgear::SentryXMLErrorSupression dontReportXmlErrors;
|
||||||
SG_LOG(SG_INPUT, SG_ALERT, "parse failure reading:" << path);
|
try {
|
||||||
return;
|
readProperties(path, n);
|
||||||
}
|
} catch (sg_exception& e) {
|
||||||
|
SG_LOG(SG_INPUT, SG_ALERT, "parse failure reading:" << path);
|
||||||
|
simgear::reportFailure(simgear::LoadFailure::BadData, simgear::ErrorCode::InputDeviceConfig,
|
||||||
|
"Failed to load input device configuration:" + e.getFormattedMessage(),
|
||||||
|
path);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::string suffix = computeSuffix(n);
|
std::string suffix = computeSuffix(n);
|
||||||
string_list names;
|
string_list names;
|
||||||
for (auto nameProp : n->getChildren("name")) {
|
for (auto nameProp : n->getChildren("name")) {
|
||||||
|
|
|
@ -32,7 +32,9 @@
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
#include <simgear/debug/ErrorReportingCallback.hxx>
|
||||||
#include <simgear/props/props_io.hxx>
|
#include <simgear/props/props_io.hxx>
|
||||||
|
|
||||||
#include "FGDeviceConfigurationMap.hxx"
|
#include "FGDeviceConfigurationMap.hxx"
|
||||||
#include <Main/fg_props.hxx>
|
#include <Main/fg_props.hxx>
|
||||||
#include <Scripting/NasalSys.hxx>
|
#include <Scripting/NasalSys.hxx>
|
||||||
|
@ -202,6 +204,9 @@ void FGJoystickInput::postinit()
|
||||||
if (!js_node || js->notWorking())
|
if (!js_node || js->notWorking())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
// FIXME : need to get input device path to disambiguate
|
||||||
|
simgear::ErrorReportContext errCtx("input-device", "");
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
JOYCAPS jsCaps ;
|
JOYCAPS jsCaps ;
|
||||||
joyGetDevCaps( i, &jsCaps, sizeof(jsCaps) );
|
joyGetDevCaps( i, &jsCaps, sizeof(jsCaps) );
|
||||||
|
@ -244,7 +249,12 @@ void FGJoystickInput::postinit()
|
||||||
unsigned int j;
|
unsigned int j;
|
||||||
for (j = 0; j < nasal.size(); j++) {
|
for (j = 0; j < nasal.size(); j++) {
|
||||||
nasal[j]->setStringValue("module", module.c_str());
|
nasal[j]->setStringValue("module", module.c_str());
|
||||||
nasalsys->handleCommand(nasal[j],nullptr);
|
bool ok = nasalsys->handleCommand(nasal[j], nullptr);
|
||||||
|
if (!ok) {
|
||||||
|
// TODO: get the Nasal errors logged properly
|
||||||
|
simgear::reportFailure(simgear::LoadFailure::BadData, simgear::ErrorCode::InputDeviceConfig,
|
||||||
|
"Failed to parse input device Nasal");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -11,16 +11,18 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
#include <simgear/sg_inlines.h>
|
#include <simgear/debug/ErrorReportingCallback.hxx>
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/logstream.hxx>
|
||||||
#include <simgear/math/sg_random.h>
|
|
||||||
#include <simgear/io/iostreams/sgstream.hxx>
|
#include <simgear/io/iostreams/sgstream.hxx>
|
||||||
#include <simgear/structure/exception.hxx>
|
#include <simgear/math/sg_random.h>
|
||||||
#include <simgear/structure/commands.hxx>
|
|
||||||
#include <simgear/props/props.hxx>
|
#include <simgear/props/props.hxx>
|
||||||
#include <simgear/props/props_io.hxx>
|
#include <simgear/props/props_io.hxx>
|
||||||
|
#include <simgear/sg_inlines.h>
|
||||||
|
#include <simgear/structure/commands.hxx>
|
||||||
#include <simgear/structure/event_mgr.hxx>
|
#include <simgear/structure/event_mgr.hxx>
|
||||||
|
#include <simgear/structure/exception.hxx>
|
||||||
#include <simgear/timing/sg_time.hxx>
|
#include <simgear/timing/sg_time.hxx>
|
||||||
|
|
||||||
#include <Network/RemoteXMLRequest.hxx>
|
#include <Network/RemoteXMLRequest.hxx>
|
||||||
|
|
||||||
#include <FDM/flight.hxx>
|
#include <FDM/flight.hxx>
|
||||||
|
@ -817,6 +819,8 @@ do_load_xml_to_proptree(const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
{
|
{
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
SG_LOG(SG_IO, SG_ALERT, "loadxml: Cannot find XML property file '" << file << "'.");
|
SG_LOG(SG_IO, SG_ALERT, "loadxml: Cannot find XML property file '" << file << "'.");
|
||||||
|
simgear::reportFailure(simgear::LoadFailure::NotFound, simgear::ErrorCode::XMLLoadCommand,
|
||||||
|
"loadxml: no such file:" + file.utf8Str(), file);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -825,6 +829,8 @@ do_load_xml_to_proptree(const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
if (!XMLLoader::findAirportData(icao, file.utf8Str(), file)) {
|
if (!XMLLoader::findAirportData(icao, file.utf8Str(), file)) {
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
SG_LOG(SG_IO, SG_INFO, "loadxml: failed to find airport data for " << file << " at ICAO:" << icao);
|
SG_LOG(SG_IO, SG_INFO, "loadxml: failed to find airport data for " << file << " at ICAO:" << icao);
|
||||||
|
simgear::reportFailure(simgear::LoadFailure::NotFound, simgear::ErrorCode::XMLLoadCommand,
|
||||||
|
"loadxml: no airprot data file for:" + icao, file);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -852,15 +858,17 @@ do_load_xml_to_proptree(const SGPropertyNode * arg, SGPropertyNode * root)
|
||||||
|
|
||||||
// don't report Sentry errors for Nasal-loaded XML, since it makes
|
// don't report Sentry errors for Nasal-loaded XML, since it makes
|
||||||
// for very noisy reports
|
// for very noisy reports
|
||||||
flightgear::sentryThreadReportXMLErrors(false);
|
flightgear::SentryXMLErrorSupression xmls;
|
||||||
try {
|
try {
|
||||||
readProperties(validated_path, targetnode, true);
|
readProperties(validated_path, targetnode, true);
|
||||||
} catch (const sg_exception &e) {
|
} catch (const sg_exception &e) {
|
||||||
|
if (!quiet) {
|
||||||
|
simgear::reportFailure(simgear::LoadFailure::BadData, simgear::ErrorCode::XMLLoadCommand,
|
||||||
|
"loadxml exception:" + e.getFormattedMessage(), e.getLocation());
|
||||||
|
}
|
||||||
SG_LOG(SG_IO, quiet ? SG_DEV_WARN : SG_WARN, "loadxml exception: " << e.getFormattedMessage());
|
SG_LOG(SG_IO, quiet ? SG_DEV_WARN : SG_WARN, "loadxml exception: " << e.getFormattedMessage());
|
||||||
flightgear::sentryThreadReportXMLErrors(true);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
flightgear::sentryThreadReportXMLErrors(true);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,9 @@
|
||||||
#include <cstring> // for strcmp()
|
#include <cstring> // for strcmp()
|
||||||
|
|
||||||
#include <simgear/compiler.h>
|
#include <simgear/compiler.h>
|
||||||
|
#include <simgear/debug/ErrorReportingCallback.hxx>
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/logstream.hxx>
|
||||||
|
|
||||||
#include <simgear/structure/exception.hxx>
|
#include <simgear/structure/exception.hxx>
|
||||||
#include <simgear/misc/sg_path.hxx>
|
#include <simgear/misc/sg_path.hxx>
|
||||||
#include <simgear/scene/model/placement.hxx>
|
#include <simgear/scene/model/placement.hxx>
|
||||||
|
@ -74,13 +76,20 @@ FGAircraftModel::init ()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
simgear::ErrorReportContext ec("primary-aircraft", "yes");
|
||||||
|
|
||||||
SGPropertyNode_ptr sim = fgGetNode("/sim", true);
|
SGPropertyNode_ptr sim = fgGetNode("/sim", true);
|
||||||
for (auto model : sim->getChildren("model")) {
|
for (auto model : sim->getChildren("model")) {
|
||||||
std::string path = model->getStringValue("path", "Models/Geometry/glider.ac");
|
std::string path = model->getStringValue("path", "Models/Geometry/glider.ac");
|
||||||
std::string usage = model->getStringValue("usage", "external");
|
std::string usage = model->getStringValue("usage", "external");
|
||||||
|
|
||||||
|
simgear::ErrorReportContext ec("aircraft-model", path);
|
||||||
|
|
||||||
SGPath resolvedPath = globals->resolve_aircraft_path(path);
|
SGPath resolvedPath = globals->resolve_aircraft_path(path);
|
||||||
if (resolvedPath.isNull()) {
|
if (resolvedPath.isNull()) {
|
||||||
|
simgear::reportFailure(simgear::LoadFailure::NotFound,
|
||||||
|
simgear::ErrorCode::XMLModelLoad,
|
||||||
|
"Failed to find aircraft model", SGPath::fromUtf8(path));
|
||||||
SG_LOG(SG_AIRCRAFT, SG_ALERT, "Failed to find aircraft model: " << path);
|
SG_LOG(SG_AIRCRAFT, SG_ALERT, "Failed to find aircraft model: " << path);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -89,6 +98,10 @@ FGAircraftModel::init ()
|
||||||
try {
|
try {
|
||||||
node = fgLoad3DModelPanel( resolvedPath, globals->get_props());
|
node = fgLoad3DModelPanel( resolvedPath, globals->get_props());
|
||||||
} catch (const sg_exception &ex) {
|
} catch (const sg_exception &ex) {
|
||||||
|
simgear::reportFailure(simgear::LoadFailure::BadData,
|
||||||
|
simgear::ErrorCode::XMLModelLoad,
|
||||||
|
"Failed to load aircraft model:" + ex.getFormattedMessage(),
|
||||||
|
ex.getLocation());
|
||||||
SG_LOG(SG_AIRCRAFT, SG_ALERT, "Failed to load aircraft from " << path << ':');
|
SG_LOG(SG_AIRCRAFT, SG_ALERT, "Failed to load aircraft from " << path << ':');
|
||||||
SG_LOG(SG_AIRCRAFT, SG_ALERT, " " << ex.getFormattedMessage());
|
SG_LOG(SG_AIRCRAFT, SG_ALERT, " " << ex.getFormattedMessage());
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,19 +33,20 @@
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include <simgear/nasal/nasal.h>
|
|
||||||
#include <simgear/nasal/iolib.h>
|
|
||||||
#include <simgear/props/props.hxx>
|
|
||||||
#include <simgear/math/sg_random.h>
|
|
||||||
#include <simgear/misc/sg_path.hxx>
|
|
||||||
#include <simgear/io/iostreams/sgstream.hxx>
|
|
||||||
#include <simgear/misc/sg_dir.hxx>
|
|
||||||
#include <simgear/misc/strutils.hxx>
|
|
||||||
#include <simgear/misc/SimpleMarkdown.hxx>
|
|
||||||
#include <simgear/structure/commands.hxx>
|
|
||||||
#include <simgear/math/sg_geodesy.hxx>
|
|
||||||
#include <simgear/structure/event_mgr.hxx>
|
|
||||||
#include <simgear/debug/BufferedLogCallback.hxx>
|
#include <simgear/debug/BufferedLogCallback.hxx>
|
||||||
|
#include <simgear/debug/ErrorReportingCallback.hxx>
|
||||||
|
#include <simgear/io/iostreams/sgstream.hxx>
|
||||||
|
#include <simgear/math/sg_geodesy.hxx>
|
||||||
|
#include <simgear/math/sg_random.h>
|
||||||
|
#include <simgear/misc/SimpleMarkdown.hxx>
|
||||||
|
#include <simgear/misc/sg_dir.hxx>
|
||||||
|
#include <simgear/misc/sg_path.hxx>
|
||||||
|
#include <simgear/misc/strutils.hxx>
|
||||||
|
#include <simgear/nasal/iolib.h>
|
||||||
|
#include <simgear/nasal/nasal.h>
|
||||||
|
#include <simgear/props/props.hxx>
|
||||||
|
#include <simgear/structure/commands.hxx>
|
||||||
|
#include <simgear/structure/event_mgr.hxx>
|
||||||
|
|
||||||
#include <simgear/nasal/cppbind/from_nasal.hxx>
|
#include <simgear/nasal/cppbind/from_nasal.hxx>
|
||||||
#include <simgear/nasal/cppbind/to_nasal.hxx>
|
#include <simgear/nasal/cppbind/to_nasal.hxx>
|
||||||
|
|
|
@ -31,14 +31,16 @@
|
||||||
|
|
||||||
#include "fg_fx.hxx"
|
#include "fg_fx.hxx"
|
||||||
|
|
||||||
#include <algorithm>
|
|
||||||
#include <Main/fg_props.hxx>
|
#include <Main/fg_props.hxx>
|
||||||
#include <Main/globals.hxx>
|
#include <Main/globals.hxx>
|
||||||
|
#include <Main/sentryIntegration.hxx>
|
||||||
#include <Sound/soundmanager.hxx>
|
#include <Sound/soundmanager.hxx>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
#include <simgear/debug/ErrorReportingCallback.hxx>
|
||||||
|
#include <simgear/misc/sg_path.hxx>
|
||||||
#include <simgear/props/props.hxx>
|
#include <simgear/props/props.hxx>
|
||||||
#include <simgear/props/props_io.hxx>
|
#include <simgear/props/props_io.hxx>
|
||||||
#include <simgear/misc/sg_path.hxx>
|
|
||||||
#include <simgear/sound/xmlsound.hxx>
|
#include <simgear/sound/xmlsound.hxx>
|
||||||
|
|
||||||
FGFX::FGFX ( const std::string &refname, SGPropertyNode *props ) :
|
FGFX::FGFX ( const std::string &refname, SGPropertyNode *props ) :
|
||||||
|
@ -120,6 +122,8 @@ FGFX::init()
|
||||||
SGPath path = globals->resolve_aircraft_path(path_str);
|
SGPath path = globals->resolve_aircraft_path(path_str);
|
||||||
if (path.isNull())
|
if (path.isNull())
|
||||||
{
|
{
|
||||||
|
simgear::reportFailure(simgear::LoadFailure::NotFound, simgear::ErrorCode::AudioFX,
|
||||||
|
"Failed to find FX XML file:" + path_str, sg_location{path_str});
|
||||||
SG_LOG(SG_SOUND, SG_ALERT,
|
SG_LOG(SG_SOUND, SG_ALERT,
|
||||||
"File not found: '" << path_str);
|
"File not found: '" << path_str);
|
||||||
return;
|
return;
|
||||||
|
@ -129,8 +133,11 @@ FGFX::init()
|
||||||
|
|
||||||
SGPropertyNode root;
|
SGPropertyNode root;
|
||||||
try {
|
try {
|
||||||
|
flightgear::SentryXMLErrorSupression xmls;
|
||||||
readProperties(path, &root);
|
readProperties(path, &root);
|
||||||
} catch (const sg_exception &) {
|
} catch (const sg_exception& e) {
|
||||||
|
simgear::reportFailure(simgear::LoadFailure::BadData, simgear::ErrorCode::AudioFX,
|
||||||
|
"Failure loading FX XML:" + e.getFormattedMessage(), e.getLocation());
|
||||||
SG_LOG(SG_SOUND, SG_ALERT,
|
SG_LOG(SG_SOUND, SG_ALERT,
|
||||||
"Error reading file '" << path << '\'');
|
"Error reading file '" << path << '\'');
|
||||||
return;
|
return;
|
||||||
|
@ -150,6 +157,8 @@ FGFX::init()
|
||||||
}
|
}
|
||||||
} catch ( sg_exception &e ) {
|
} catch ( sg_exception &e ) {
|
||||||
SG_LOG(SG_SOUND, SG_ALERT, e.getFormattedMessage());
|
SG_LOG(SG_SOUND, SG_ALERT, e.getFormattedMessage());
|
||||||
|
simgear::reportFailure(simgear::LoadFailure::BadData, simgear::ErrorCode::AudioFX,
|
||||||
|
"Failure creating Audio FX:" + e.getFormattedMessage(), path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue