Skip to content

Commit

Permalink
Merge pull request #13065 from Habbie/auth-backend-errorlogging
Browse files Browse the repository at this point in the history
auth: report which backend failed to instantiate
  • Loading branch information
Habbie committed Jul 31, 2023
2 parents 952d96f + 1c5140c commit 360bc53
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pdns/dnsbackend.cc
Expand Up @@ -188,8 +188,11 @@ vector<DNSBackend *> BackendMakerClass::all(bool metadataOnly)

ret.reserve(d_instances.size());

std::string current; // to make the exception text more useful

try {
for (const auto& instance : d_instances) {
current = instance.first + instance.second;
DNSBackend *made = nullptr;

if (metadataOnly) {
Expand All @@ -207,15 +210,15 @@ vector<DNSBackend *> BackendMakerClass::all(bool metadataOnly)
}
}
catch(const PDNSException &ae) {
g_log<<Logger::Error<<"Caught an exception instantiating a backend: "<<ae.reason<<endl;
g_log<<Logger::Error<<"Caught an exception instantiating a backend (" << current << "): "<<ae.reason<<endl;
g_log<<Logger::Error<<"Cleaning up"<<endl;
for (auto i : ret) {
delete i;
}
throw;
} catch(...) {
// and cleanup
g_log<<Logger::Error<<"Caught an exception instantiating a backend, cleaning up"<<endl;
g_log<<Logger::Error<<"Caught an exception instantiating a backend (" << current <<"), cleaning up"<<endl;
for (auto i : ret) {
delete i;
}
Expand Down

0 comments on commit 360bc53

Please sign in to comment.