Giter VIP home page Giter VIP logo

Comments (3)

benjaminjkraft avatar benjaminjkraft commented on August 23, 2024

That seems like a sensible thing to add, but I'm not sure offhand what the API would look like. We could add an As-able error type I guess? What do you mean by "the standard error"? Does net/http, or some other stdlib package, have a thing we should be using?

BTW, you can already (a) get direct access to the error and/or (b) retry it by writing your own graphql.Client, or passing a modified http.Client which, say, retries on 429. But I can see how sometimes you would want to know the status code in the application code instead.

from genqlient.

jasonkwh avatar jasonkwh commented on August 23, 2024

I mean, we can standardise the error messages and return those error messages when something is happening.

On my situation, at the moment i am using strings.prefix to match if there is a 429 error. While implementing the standard error messages, I can just compare the returned error with the gql client provided error. It's a nicer way to handle errors isn't it?

from genqlient.

benjaminjkraft avatar benjaminjkraft commented on August 23, 2024

Yeah, looking more there really doesn't seem to be a standard. Ah well, I guess we can make our own As-able error. We already document As-ability to gqlerror.List (and should probably mention it on client.MakeRequest as well) so we can add similar mention there.

Anyway, PRs are welcome! I think this should be a pretty easy one.

from genqlient.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.