-
Notifications
You must be signed in to change notification settings - Fork 550
Map exception to rcode #1249
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
Map exception to rcode #1249
Conversation
|
While I understand this might be useful for your specific application, it doesn't make sense to include this in a general dns handling package. You really can't translate an exception into a return code in a way that isn't application specific. As one example for all, |
My understanding is that |
That would be the case for a resolver deciding what return code to put into an answer for a client when the query fails to resolve. But imagine dnspython is used as a client instead. You send a query and receive no answer over the network, aka |
Yes, it would be a one-way mapping exception to rcode. This is why I created a |
|
I agree with Nicki's comments about the non-generality of this function. It also has incorrect mappings (e.g. BADSIG is a TSIG error; DNSSEC validation failures are usually SERVFAILs). I am concerned that you are doing a bunch of work that is not going to be something I would merge. |
fd0ea3c to
8325bce
Compare
Fixed.
This is unfortunate as the Python DNS package ecosystem is already very fragmented (more than 3000 results for "dns" query on pypi.org). Not merging it here leaves me with the options:
|
|
I still don't think there is a useful generalization of exception to rcode and so I will close this PR. |
This makes error handling a lot easier.
I am not sure if it would be better to add a field to each Exception class with the preferred rcode, but this would require all exception modules to import rcode as well.