Commit 7ec44914 authored by Jelte Jansen's avatar Jelte Jansen

folded some long lines

parent a030bd71
...@@ -315,18 +315,23 @@ ModuleCCSession::checkCommand() { ...@@ -315,18 +315,23 @@ ModuleCCSession::checkCommand() {
if (target_module == module_name_) { if (target_module == module_name_) {
if (command_handler_) { if (command_handler_) {
ElementPtr errors = Element::createList(); ElementPtr errors = Element::createList();
if (module_specification_.validate_command(cmd_str, arg, errors)) { if (module_specification_.validate_command(cmd_str,
arg,
errors)) {
answer = command_handler_(cmd_str, arg); answer = command_handler_(cmd_str, arg);
} else { } else {
std::stringstream ss; std::stringstream ss;
ss << "Error in command validation: "; ss << "Error in command validation: ";
BOOST_FOREACH(ConstElementPtr error, errors->listValue()) { BOOST_FOREACH(ConstElementPtr error,
errors->listValue()) {
ss << error->stringValue(); ss << error->stringValue();
} }
answer = createAnswer(3, ss.str()); answer = createAnswer(3, ss.str());
} }
} else { } else {
answer = createAnswer(1, "Command given but no command handler for module"); answer = createAnswer(1,
"Command given but no "
"command handler for module");
} }
} }
} }
......
...@@ -190,7 +190,8 @@ ModuleSpec::validate_command(const std::string& command, ...@@ -190,7 +190,8 @@ ModuleSpec::validate_command(const std::string& command,
ConstElementPtr commands_spec = module_specification->find("commands"); ConstElementPtr commands_spec = module_specification->find("commands");
if (args->getType() != Element::map) { if (args->getType() != Element::map) {
errors->add(Element::create("args for command " + command + " is not a map")); errors->add(Element::create("args for command " +
command + " is not a map"));
return (false); return (false);
} }
...@@ -202,7 +203,8 @@ ModuleSpec::validate_command(const std::string& command, ...@@ -202,7 +203,8 @@ ModuleSpec::validate_command(const std::string& command,
BOOST_FOREACH(ConstElementPtr cur_command, commands_spec->listValue()) { BOOST_FOREACH(ConstElementPtr cur_command, commands_spec->listValue()) {
if (cur_command->get("command_name")->stringValue() == command) { if (cur_command->get("command_name")->stringValue() == command) {
return (validate_spec_list(cur_command->get("command_args"), args, true, errors)); return (validate_spec_list(cur_command->get("command_args"),
args, true, errors));
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment