From: n0tlu5 Date: Fri, 24 May 2024 06:35:04 +0000 (+0700) Subject: reduce exception handling X-Git-Tag: dnsdist-2.0.0-alpha1~178^2~13 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1676c6d3f36826da5126a8ca2ef2ab78b2265ed1;p=thirdparty%2Fpdns.git reduce exception handling --- diff --git a/pdns/lua-record.cc b/pdns/lua-record.cc index cf95e0ea35..0a0f5dbad0 100644 --- a/pdns/lua-record.cc +++ b/pdns/lua-record.cc @@ -128,8 +128,9 @@ private: throw std::runtime_error(boost::str(boost::format("unable to match content with `%s`") % cd.opts.at("stringmatch"))); } + int weight = 0; try { - stoi(content); + weight = stoi(content); if(!status) { g_log<weight = stoi(content); - } catch (const PDNSException& e) { - // set weight to 0 - state->weight = 0; - } + state->weight = weight; if (state->first) { state->first = false; }