Changeset 1075


Ignore:
Timestamp:
03/16/17 15:04:46 (4 years ago)
Author:
mhnguyen
Message:

Improving error message of variable parsing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS/trunk/src/node/variable.cpp

    r773 r1075  
    4040      if (!node.getContent(this->content)) 
    4141      { 
     42        xml::THashAttributes attributes = node.getAttributes(); 
     43        StdString variableName = attributes["name"]; 
     44 
     45        node.goToParentElement(); 
     46        StdString parentName = node.getElementName(); 
     47        attributes = node.getAttributes(); 
     48        error << "The variable id = " << id << " and name = " << variableName << " does not have any content. Please define it!" << std::endl 
     49              << "This variable is inside another element whose attributes are :" << std::endl; 
     50 
     51        for (xml::THashAttributes::iterator it = attributes.begin(); it != attributes.end(); ++it) 
     52        { 
     53           error << it->first << "=\"" << it->second.c_str() << "\" "; 
     54        } 
     55        error << std::endl;  
     56 
    4257         ERROR("CVariable::parse(xml::CXMLNode & node)", 
    4358               << "[ variable id = " << id 
    44                << " ] variable is not defined !"); 
     59               << " ] variable is not defined !. It does not have any content. See error log for more details."); 
    4560      } 
    4661      content = boost::trim_copy(content) ; 
Note: See TracChangeset for help on using the changeset viewer.