Giter Site home page Giter Site logo

Comments (5)

domenic avatar domenic commented on June 16, 2024

You can add properties to the TypeError. That seems better?

(It's not currently possible in Web IDL, but we'd add that.)

from webidl.

annevk avatar annevk commented on June 16, 2024

Yeah maybe. @littledan @syg thoughts from a JS perspective?

Having said, I think that eventually standardizing messages would be good too, but if we can avoid them being the sole mechanism to rely on that would be a lot better.

from webidl.

syg avatar syg commented on June 16, 2024

You can add properties to the TypeError. That seems better?

Does this mean adding data properties to TypeError instances created by fetch()? I don't really see any issue with that, aside from unlikely compat issues around libraries that might be doing that already if the new property name is something common.

from webidl.

domenic avatar domenic commented on June 16, 2024

Does this mean adding data properties to TypeError instances created by fetch()?

Yep, that's what I meant.

(Or, I guess, own accessor properties, but own data properties would make more sense.)

from webidl.

bakkot avatar bakkot commented on June 16, 2024

Node uses error.code = "SOME_FIXED_STRING" and it's great. I would love to see that adopted on the web.

I don't see any problems with it from the JS side, though it's unlikely that errors thrown by JS would get such a property in the near future.

Do note that this can make optimizations which are formally (but not practically) unobservable suddenly be observable: right now if there's two adjacent steps which throw a TypeError and no user code runs between them, an engine can do those steps in whichever order is more convenient for it, and with this change would be required to do them in a particular order. But that's only very rarely going to be an issue, I think, and in any case users already depend on the unspecified message strings and so practically many of these things are observable anyway.

from webidl.

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.