-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Wrap errors so that details are more visible #510
Comments
@olivere if you don't mind, I'd like to get cracking on this one next. What do you think should the strategy here be? Should we do it in phases (i.e. per ES endpoint) or one big bang? Also we might want to consider drafting a list of "underlying reasons" or "friendly messages" for certain error classes. I'm happy to draft one up for your review. |
@eticzon Thanks for your helping hand. It'd be awesome if we could start with those Right now, elastic is swalling most of the underlying errors. It could probably be as simple as wrapping the underlying error via |
Thanks for the quick reply. 👍 Ok I'll start with those |
I also added the |
+1! Thanks for that. |
I've opened #518 to get the ball rolling. Let me know if this shallow |
I like the error messages. Not too chatty and to the point. 👍 However, the wrapping could become a problem in that existing clients can no longer compare
... because it will directly compare the error with the I personally don't think it's too critical as this typically only happens at startup and clients should typically check if there's an error at all, not the specific type... But maybe we should be more explicit about the change. I think we have two options:
Regardless of 1 or 2, we should probably provide a helper function like What is your opinion about this? |
Thanks for the feedback @olivere. 👍 Actually, to make the tests pass I already did item 1 (like what you've mentioned) in the PR:
Out of the two options, I would prefer item 1. IMHO, item 2 will result to the same thing even if we rename the error (unless you're also planning on introducing other error types). Maybe there's something I'm missing here? I do agree that we should have the helper function. That way the tests won't also be coupled with the Also that goes in line with what is said in this blog: https://dave.cheney.net/2016/04/27/dont-just-check-errors-handle-them-gracefully |
I've updated #518 to add the helper |
Sorry for the lack of feedback. I've been out for a few days... I think the helper is good. And as far as I see there's no need to import I'll give it another 2-3 days and hopefully find the time to merge over the weekend. Thanks again for your helping hand! |
Not a problem at all.
We've decoupled |
I think importing What I'd dislike is that users of |
I just merged the changes. Thanks for your support! |
You're welcome @olivere! |
Use e.g. github.com/pkg/errors to wrap certain errors and make them more visible.
The goal is to make the underlying reason for certain errors more transparent, e.g.
elastic.ErrNoClient
.The text was updated successfully, but these errors were encountered: