Add try/catch wrappers in SGSubsystemGroup
Attempt to narrow down the source of some fatal exceptions we see on Senty, which occur during init/startup. All these blocks re-throw so user behaviour is unchanged, but we’ll log the name of the subsytem.
This commit is contained in:
parent
71e7050349
commit
d6400e3737
@ -251,9 +251,14 @@ SGSubsystemGroup::init ()
|
|||||||
{
|
{
|
||||||
assert(_state == State::BIND);
|
assert(_state == State::BIND);
|
||||||
forEach([this](SGSubsystem* s) {
|
forEach([this](SGSubsystem* s) {
|
||||||
|
try {
|
||||||
this->notifyWillChange(s, State::INIT);
|
this->notifyWillChange(s, State::INIT);
|
||||||
s->init();
|
s->init();
|
||||||
this->notifyDidChange(s, State::INIT);
|
this->notifyDidChange(s, State::INIT);
|
||||||
|
} catch (std::exception& e) {
|
||||||
|
simgear::reportError("Caught exception init-ing subsystem " + s->subsystemId() + "\n\t" + e.what());
|
||||||
|
throw;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
_state = State::INIT;
|
_state = State::INIT;
|
||||||
}
|
}
|
||||||
@ -283,7 +288,15 @@ SGSubsystemGroup::incrementalInit()
|
|||||||
const auto m = _members[_initPosition];
|
const auto m = _members[_initPosition];
|
||||||
SGTimeStamp st;
|
SGTimeStamp st;
|
||||||
st.stamp();
|
st.stamp();
|
||||||
const InitStatus memberStatus = m->subsystem->incrementalInit();
|
InitStatus memberStatus;
|
||||||
|
|
||||||
|
try {
|
||||||
|
memberStatus = m->subsystem->incrementalInit();
|
||||||
|
} catch (std::exception& e) {
|
||||||
|
simgear::reportError("Caught exception init-ing subsystem " + m->subsystem->subsystemId() + "\n\t" + e.what());
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
m->initTime += st.elapsedMSec();
|
m->initTime += st.elapsedMSec();
|
||||||
|
|
||||||
if (memberStatus == INIT_DONE) {
|
if (memberStatus == INIT_DONE) {
|
||||||
@ -352,9 +365,14 @@ void
|
|||||||
SGSubsystemGroup::bind ()
|
SGSubsystemGroup::bind ()
|
||||||
{
|
{
|
||||||
forEach([this](SGSubsystem* s) {
|
forEach([this](SGSubsystem* s) {
|
||||||
|
try {
|
||||||
this->notifyWillChange(s, State::BIND);
|
this->notifyWillChange(s, State::BIND);
|
||||||
s->bind();
|
s->bind();
|
||||||
this->notifyDidChange(s, State::BIND);
|
this->notifyDidChange(s, State::BIND);
|
||||||
|
} catch (std::exception& e) {
|
||||||
|
simgear::reportError("Caught exception binding subsystem " + s->subsystemId() + "\n\t" + e.what());
|
||||||
|
throw;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
_state = State::BIND;
|
_state = State::BIND;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user