X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=simgear%2Fstructure%2FSGBinding.cxx;h=8ca19034daeddff8737c3c48b53609034c64affd;hb=5af8bb7c8e259f5bdda67beb87adcc453e0b32e7;hp=e65b4d2a8bf584a3928f9f06bd1605e7b1f8e17b;hpb=ce2a6cfe5c640e9c12a974a0ce4b2d12a19c672e;p=simgear.git diff --git a/simgear/structure/SGBinding.cxx b/simgear/structure/SGBinding.cxx index e65b4d2a..8ca19034 100644 --- a/simgear/structure/SGBinding.cxx +++ b/simgear/structure/SGBinding.cxx @@ -7,9 +7,15 @@ * $Id$ */ +#ifdef HAVE_CONFIG_H +# include +#endif + #include #include "SGBinding.hxx" +#include + SGBinding::SGBinding() : _command(0), _arg(new SGPropertyNode), @@ -56,9 +62,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() << ")"); + } } } }