1
0
Fork 0

Event-input: Change reporting of failure to open

Don’t use an exception here, not needed and makes for noise on the
reporting backedning.
This commit is contained in:
James Turner 2021-01-01 16:21:33 +00:00
parent e1caf04b41
commit f5eadf2e37

View file

@ -481,22 +481,18 @@ unsigned FGEventInput::AddDevice( FGInputDevice * inputDevice )
inputDevice->Configure( deviceNode ); inputDevice->Configure( deviceNode );
try {
bool ok = inputDevice->Open(); bool ok = inputDevice->Open();
if (ok) { if (!ok) {
input_devices[ deviceNode->getIndex() ] = inputDevice; // TODO repot a better error here, to the user
} else { SG_LOG(SG_INPUT, SG_ALERT, "can't open InputDevice " << inputDevice->GetUniqueName());
throw sg_exception("Opening input device failed"); delete inputDevice;
} return INVALID_DEVICE_INDEX;
} }
catch( ... ) {
SG_LOG(SG_INPUT, SG_ALERT, "can't open InputDevice " << inputDevice->GetUniqueName() );
delete inputDevice;
return INVALID_DEVICE_INDEX;
}
SG_LOG(SG_INPUT, SG_DEBUG, "using InputDevice " << inputDevice->GetUniqueName() ); input_devices[deviceNode->getIndex()] = inputDevice;
return deviceNode->getIndex();
SG_LOG(SG_INPUT, SG_DEBUG, "using InputDevice " << inputDevice->GetUniqueName());
return deviceNode->getIndex();
} }
void FGEventInput::RemoveDevice( unsigned index ) void FGEventInput::RemoveDevice( unsigned index )