Changeset 1235

Show
Ignore:
Timestamp:
07/17/08 22:34:46 (20 months ago)
Author:
ahu
Message:

improve error messages generated by the zoneparser-tng

Location:
trunk/pdns/pdns
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/pdns/pdns/zoneparser-tng.cc

    r1234 r1235  
    101101 
    102102    default: 
    103       throw ZoneParserTNG::exception("Unable to parse time specification '"+str+"' on line "+ 
    104                                      lexical_cast<string>(d_filestates.top().d_lineno)+" of file '"+ 
    105                                      d_filestates.top().d_filename+"'"); 
     103      throw ZoneParserTNG::exception("Unable to parse time specification '"+str+"' "+getLineOfFile()); 
    106104    } 
    107105  return val; 
     
    219217} 
    220218 
    221  
     219string ZoneParserTNG::getLineOfFile() 
     220{ 
     221  return "on line "+lexical_cast<string>(d_filestates.top().d_lineno)+" of file '"+d_filestates.top().d_filename+"'"; 
     222} 
    222223 
    223224bool ZoneParserTNG::get(DNSResourceRecord& rr)  
     
    265266    } 
    266267    else 
    267       throw exception("Can't parse zone line '"+d_line+"' on line "+lexical_cast<string>(d_filestates.top().d_lineno)+ 
    268                       " of file '"+d_filestates.top().d_filename); 
     268      throw exception("Can't parse zone line '"+d_line+"' "+getLineOfFile()); 
    269269    goto retry; 
    270270  } 
     
    287287 
    288288  if(parts.empty())  
    289     throw exception("Line with too little parts"); 
     289    throw exception("Line with too little parts "+getLineOfFile()); 
    290290 
    291291  string nextpart; 
     
    327327    } 
    328328    catch(...) { 
    329       throw runtime_error("Parsing zone content on line "+ 
    330                           lexical_cast<string>(d_filestates.top().d_lineno)+ 
    331                           " of file '"+d_filestates.top().d_filename+"': '"+nextpart+ 
     329      throw runtime_error("Parsing zone content "+getLineOfFile()+ 
     330                          ": '"+nextpart+ 
    332331                          "' doesn't look like a qtype, stopping loop"); 
    333332    } 
    334333  } 
    335334  if(!haveQTYPE)  
    336     throw exception("Malformed line "+lexical_cast<string>(d_filestates.top().d_lineno)+" of '"+d_filestates.top().d_filename+"': "+d_line+"'"); 
     335    throw exception("Malformed line "+getLineOfFile()+": '"+d_line+"'"); 
    337336 
    338337  rr.content=d_line.substr(range.first); 
  • trunk/pdns/pdns/zoneparser-tng.hh

    r1056 r1235  
    4141  void stackFile(const std::string& fname); 
    4242  unsigned makeTTLFromZone(const std::string& str); 
     43  string getLineOfFile(); 
    4344  string d_reldir; 
    4445  string d_line;