-
Notifications
You must be signed in to change notification settings - Fork 905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better error message for unfound new slave domains #3051
Better error message for unfound new slave domains #3051
Conversation
@@ -818,7 +820,10 @@ void Bind2Backend::loadConfig(string* status) | |||
} | |||
catch(std::exception &ae) { | |||
ostringstream msg; | |||
msg<<" error at "+nowTime()+" parsing '"<<i->name.toString()<<"' from file '"<<i->filename<<"': "<<ae.what(); | |||
if (strcmp(ae.what(), "No such file or directory") && isNew && i->type == "slave") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That strcmp
smells bad :)
My eyes :( |
8fe8cff
to
b2ceb76
Compare
Could use another review |
LGTM. 👍 |
Doing the errno check that late is probably unsafe/unportable. |
Could you catch http://en.cppreference.com/w/cpp/io/ios_base/failure instead? It comes with error code. Or std::system_error, has code as well. |
b2ceb76
to
cfbc538
Compare
The zoneparser now throws a |
|
cfbc538
to
1c18a27
Compare
std::errorcode is c++2011, interesting that it fails on travis |
LGTM (pending figuring out why Travis is throwing a fit) |
Can't help with the build issue on travis, but I'd recommend deploying a function like this somewhere to avoid code bloat with system_error namespace { // or mark it static
template <typename Message> __attribute__ ((noinline, cold, noreturn))
void throw_errno (Message&& msg) {
throw std::system_error (errno, std::system_category(),
std::forward<Message> (msg));
}
} You can see what kind of codegen you get without it, even at -O2, here: http://goo.gl/Kzfcsw |
Please note the small warning sign on the cplusplus.com page:
|
It seems to work by adding |
ostringstream msg; | ||
msg<<" error at "+nowTime()+" parsing '"<<i->name.toString()<<"' from file '"<<i->filename<<"': "<<ae.what(); | ||
if (ae.code().value() == ENOENT && isNew && i->type == "slave") | ||
msg<<" error at "+nowTime()<<" no file found for new slave domain '"<<i->name.toString()<<"'. Has not been AXFR'd yet"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Didn't the logger support printing DNSName w/o toString today?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
when #4062 is merged, ostreams support this properly
1c18a27
to
05f3f62
Compare
05f3f62
to
e0e48a7
Compare
Closes #2405