Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Print status messages in LTM and throw proper errors.
  • Loading branch information
naderman committed Jul 15, 2010
1 parent 6fefe17 commit daf4a96
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/spoac/ltm/LTM.cpp
Expand Up @@ -168,6 +168,13 @@ PlanningSlice::ActionDefinition LTM::getAction(
PlanningSlice::ActionDefinition action;

JSON::ValuePtr value = findAndParseFile("oacs", oac);

if (value->getType() != JSON::OBJECT)
{
throw Exception(std::string("OAC ") + oac +
" is not a JSON object");
}

JSON::Object& document = value->toObject();

action.name = document["name"]->toString();
Expand Down Expand Up @@ -337,9 +344,15 @@ JSON::ValuePtr LTM::findAndParseFile(

if (findFile(base, name + ".json", path))
{
std::cout << "Reading file: " << path.string() << std::endl;
JSON::Parser jsonParser;
result = jsonParser.readFromFile(path.string());
}
else
{
throw Exception(std::string("Could not find file ") + name + ".json" +
" in " + base.string());
}

return result;
}
Expand Down

0 comments on commit daf4a96

Please sign in to comment.