From 1676c6d3f36826da5126a8ca2ef2ab78b2265ed1 Mon Sep 17 00:00:00 2001 From: n0tlu5 Date: Fri, 24 May 2024 13:35:04 +0700 Subject: [PATCH] reduce exception handling --- pdns/lua-record.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) 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; } -- 2.47.2