-
-
Notifications
You must be signed in to change notification settings - Fork 29
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
feat: support vec/array impl for DnsResolver #368
feat: support vec/array impl for DnsResolver #368
Conversation
Co-authored-by: Glen De Cauwsemaecker <contact@glendc.com>
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.
Hi! thanks for picking up this PR where it was left. Left a couple of remarks already.
56915e1
to
3c6e3fc
Compare
3c6e3fc
to
ef6a816
Compare
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.
Different DnsResolvers probably have their own error types. So in that case, and given this is a generic feature, best to collect the errors as BoxError
so that we can collect the errors regardless of the types.
I have a more general question which might outside of the scope of this pull request. When do we have to implement a specific error type and when to implement only box? We could discuss in Discord if this is inappropriate to discuss here. |
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.
Minor changes still to go, other than that it seems this PR is about to be ready to be merged into the main branch! thx a lot!!!
Questions are not quickly out of scope. Also to be clear, I'm no oracle and the decisions I made and will make might be misguided or mistakes. As such it defintely is up to you and other contributors/users to scrutanise my choices and answers. Here is how I think about it:
That last point is subtle but important. Given rama is all about layers, a giant tree of possible error variants quickly explodes. At that point you'll start using your enum pretty much like a BoxError. What do I mean with that? Well the power of an enum is normally that you type-statically can handle all possible error cases or get a compile error if you forgot some case. It's in your face. However what if you have a deeply nested enum because each layer has several variants of errors. That means that as a user of this layer stack you should really handle all these cases explicitly, which no one really does, or at least not good. So what usually happens is that you would handle at that level some specific cases explicitly and others just in a very general way. Which is what you can just as well do with a BoxError by using the When I started making Rama I was defning a lot more explicit type errors, but that only really makes sense if you have a valid poossible way for your users to handle these cases. The line can be blurry though, so in case I missed the mark somewhere in rama, do feel free to open a ticket on it or discuss it on Discord or via github. In the context of this PR and its linked ticket however, I see only one way to handle this and that is with something that unites all possible errors. This because what I highlighted at the start, you have an unknown amount of errors. Doesn't have to be like that of course. As you could also design this without a Vec/Array of DnsResolvers and instead turn it into something like a |
Thanks for this detailed explanation :) @GlenDC |
Description
support vec/array impl for DnsResolver to enable chaining resolver together
Related issues
#332