]> git.mxchange.org Git - simgear.git/blobdiff - simgear/structure/SGBinding.cxx
Working 'noshadow' animation
[simgear.git] / simgear / structure / SGBinding.cxx
index 35d2ec0ec1421e739723efb33be6f0a3ff34fee7..8ca19034daeddff8737c3c48b53609034c64affd 100644 (file)
@@ -14,7 +14,7 @@
 #include <simgear/compiler.h>
 #include "SGBinding.hxx"
 
-#include <simgear/Math/SGMath.hxx>
+#include <simgear/structure/exception.hxx>
 
 SGBinding::SGBinding()
   : _command(0),
@@ -62,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() << ")");
+        }
     }
   }
 }