From: Otto Moerbeek Date: Fri, 2 Sep 2022 12:33:31 +0000 (+0200) Subject: Adapt update policy load to new loadFile semantics, which throws on error. X-Git-Tag: rec-4.8.0-alpha1~31^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dc866920b61b8b7ee9d8be8a8078d69be5dbe5b5;p=thirdparty%2Fpdns.git Adapt update policy load to new loadFile semantics, which throws on error. --- diff --git a/pdns/packethandler.cc b/pdns/packethandler.cc index f24f7f3988..f15eb3f369 100644 --- a/pdns/packethandler.cc +++ b/pdns/packethandler.cc @@ -78,7 +78,7 @@ PacketHandler::PacketHandler():B(s_programname), d_dk(&B) else { d_pdl = std::make_unique(); - d_pdl->loadFile(fname); + d_pdl->loadFile(fname); // XXX exception handling? } fname = ::arg()["lua-dnsupdate-policy-script"]; if (fname.empty()) @@ -88,7 +88,10 @@ PacketHandler::PacketHandler():B(s_programname), d_dk(&B) else { d_update_policy_lua = std::make_unique(); - if (d_update_policy_lua->loadFile(fname) != 0) { + try { + d_update_policy_lua->loadFile(fname); + } + catch (const std::runtime_error&) { d_update_policy_lua = nullptr; } }