Skip to content
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

RFC: less opaque error type #31

Open
mspiegel opened this issue Sep 25, 2018 · 2 comments
Open

RFC: less opaque error type #31

mspiegel opened this issue Sep 25, 2018 · 2 comments

Comments

@mspiegel
Copy link

I want to submit a pull request that provides a less opaque error type. This is similar to #29 but has a broader purpose. I want to get some feedback before I submit a pull request.

  1. Can I export the errors type? That will allow me to do something with the Message and Locations.

  2. How do I provide more information about where Client.do() is generating the error? I see 6 locations where an error is returned. Which is a better approach:
    a) Should I declare a different error type for each of these conditions? Is that the idiomatic Go way? That appears to be what the golang standard library does.
    b) Should I use an enum and wrap the error like this https://play.golang.org/p/xPca1LmOBbp? One advantage of this approach is that (unlike option a) we aren't declaring a new error type that is just some wrapper for another error type (like a json error type). The enum describes where the error occurs not the shape of the error.
    c) Something else?

@dmitshur
Copy link
Member

Hi @mspiegel, thank you for opening an issue to discuss this first, it's very helpful.

Yes, a less opaque error type makes sense as a next step to consider. I already alluded to it in #29 (comment):

A bigger step might be to create a struct error type with a ResponseBody []byte field in it, but I'd rather defer that until it's really needed.

I'm happy to proceed discussing this, but I would like to gather some data on the use cases first. These might seem like obvious questions, but I want to ask them anyway. Who would use this? How would they benefit? Are these situations hypothetical, or have you actually encountered them?

I would like to implement this only if it solves real problems. Understanding what those are will help us evaluate potential solutions and make sure we pick a good one.

So, can you please elaborate on why you want this, and what can't be done right now (or can only be done inconveniently).

@dmitshur dmitshur added enhancement API decision WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Sep 26, 2018
@mspiegel
Copy link
Author

mspiegel commented Sep 26, 2018 via email

@dmitshur dmitshur added thinking and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Sep 26, 2018
grihabor pushed a commit to grihabor/graphql that referenced this issue Jul 20, 2022
* use hyphen tag to skip printing fields to the query string output
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants