- } 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() << ")");
+ }