Git Product home page Git Product logo

Comments (5)

ryanbrainard avatar ryanbrainard commented on May 14, 2024

Good catch. I thought for sure I remember seeing id in the doc, but you're right that it is not there. I'm thinking I can instead do this:

e = new Error(message)
e.id = id
throw e

It's a little dirty to set the id like that as a field, but just don't want to loose that data in case someone needs it. I just tested this in the console with Chrome and it works. Would you so kind to try it on IE8 (sorry, I don't have easy access to IE8)?

from react-refetch.

imjoehaines avatar imjoehaines commented on May 14, 2024

Yeah that works fine, IE sets the message and id properly.

Would you be willing to change the name from id to something more generic, or add a new field for additional information about an error (maybe context)? We're dealing with a legacy application that often passes arbitrary data back from the server on errors and it would be nice to be able to handle the same cases without having to refactor things too much to begin with.

We could just attach it to id but it'd be nice to have a proper place for that sort of thing to live.

from react-refetch.

ryanbrainard avatar ryanbrainard commented on May 14, 2024

Thanks for testing that out.

Yes, I'd be happy to make it more generic. id is a Heroku API-specific
thing where we put error codes, and probably doesn't belong in here. What
I'm thinking is placing the entire original error in a Java-style cause
field, so then you can get to anything you want. For example, id would be
at e.cause.id and your arbitrary fields would also be accessible. Would
that work?

On Wednesday, January 13, 2016, Joe Haines [email protected] wrote:

Yeah that works fine, IE sets the message and id properly.

Would you be willing to change the name from id to something more
generic, or add a new field for additional information about an error
(maybe context)? We're dealing with a legacy application that often
passes arbitrary data back from the server on errors and it would be nice
to be able to handle the same cases without having to refactor things
too much to begin with.

We could just attach it to id but it'd be nice to have a proper place for
that sort of thing to live.


Reply to this email directly or view it on GitHub
#37 (comment)
.

from react-refetch.

imjoehaines avatar imjoehaines commented on May 14, 2024

No worries.

Yeah, that sounds like it would work perfectly!

from react-refetch.

ryanbrainard avatar ryanbrainard commented on May 14, 2024

Released in v0.7.0-beta.0

from react-refetch.

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.