From c91effc8686f2d76793374ed3e4ddf4abb5b1811 Mon Sep 17 00:00:00 2001 From: bert hubert Date: Fri, 29 Jan 2016 11:41:15 +0100 Subject: [PATCH] more methods to get line number of an error from the zoneparser --- pdns/zoneparser-tng.cc | 5 +++++ pdns/zoneparser-tng.hh | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pdns/zoneparser-tng.cc b/pdns/zoneparser-tng.cc index 569aef0db..eedbc1c66 100644 --- a/pdns/zoneparser-tng.cc +++ b/pdns/zoneparser-tng.cc @@ -249,6 +249,11 @@ string ZoneParserTNG::getLineOfFile() return "on line "+std::to_string(d_filestates.top().d_lineno)+" of file '"+d_filestates.top().d_filename+"'"; } +pair ZoneParserTNG::getLineNumAndFile() +{ + return {d_filestates.top().d_filename, d_filestates.top().d_lineno}; +} + // ODD: this function never fills out the prio field! rest of pdns compensates though bool ZoneParserTNG::get(DNSResourceRecord& rr, std::string* comment) { diff --git a/pdns/zoneparser-tng.hh b/pdns/zoneparser-tng.hh index 94fea3b2e..64d36c6d8 100644 --- a/pdns/zoneparser-tng.hh +++ b/pdns/zoneparser-tng.hh @@ -40,7 +40,8 @@ public: typedef runtime_error exception; typedef deque > parts_t; DNSName getZoneName(); - string getLineOfFile(); + string getLineOfFile(); // for error reporting purposes + pair getLineNumAndFile(); // idem private: bool getLine(); bool getTemplateLine(); -- 2.40.0