X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fstructure%2FSGBinding.cxx;h=836d7abc1364201817df01803040deeb9437a566;hb=c82df0590dd46347e2f1d0dca4cc3712f67f3654;hp=9e5fce06a5a3745a5e79dfa8b8b5bc2b5e42beaa;hpb=9cbbe5559844317f44744788ddb308101a1e75e9;p=simgear.git diff --git a/simgear/structure/SGBinding.cxx b/simgear/structure/SGBinding.cxx index 9e5fce06..836d7abc 100644 --- a/simgear/structure/SGBinding.cxx +++ b/simgear/structure/SGBinding.cxx @@ -16,6 +16,8 @@ #include +#include + SGBinding::SGBinding() : _command(0), _arg(new SGPropertyNode), @@ -62,9 +64,17 @@ SGBinding::fire () const _command = SGCommandMgr::instance()->getCommand(_command_name); if (_command == 0) { SG_LOG(SG_INPUT, SG_WARN, "No command attached to binding"); - } else if (!(*_command)(_arg)) { - SG_LOG(SG_INPUT, SG_ALERT, "Failed to execute command " - << _command_name); + } else + { + try { + if (!(*_command)(_arg)) { + SG_LOG(SG_INPUT, SG_ALERT, "Failed to execute command " + << _command_name); + } + } catch (sg_exception& e) { + SG_LOG(SG_GENERAL, SG_ALERT, "command '" << _command_name << "' failed with exception\n" + << "\tmessage:" << e.getMessage() << " (from " << e.getOrigin() << ")"); + } } } }