Intent to Ship: Error.cause property

233 views
Skip to first unread message

Victor Gomes

unread,
May 18, 2021, 11:42:29 AMMay 18
to blin...@chromium.org

Contact emails

victo...@chromium.org

Explainer

None

Specification

https://github.com/tc39/proposal-error-cause

Summary

Adds an additional options parameter to the Error() constructor with a cause property, the value of which will be assigned to the error instances as a property. This allows errors to be chained without unnecessary and overelaborate formalities on wrapping the errors in conditions.


Blink component

Blink>JavaScript>Language

Search tags

JavaScriptError

TAG review

None

TAG review status

Not applicable

Risks


Interoperability and Compatibility

None


Gecko: TC39 Stage 3 feature

WebKit: TC39 Stage 3 feature

Web developers: TC39 Stage 3 feature


Is this feature fully tested by web-platform-tests?

No

Daniel Bratell

unread,
May 20, 2021, 2:28:59 PMMay 20
to Victor Gomes, blin...@chromium.org

LGTM1

/Daniel

--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAGFuzY1AorjfOfbAoF7f-8%3DSs3gpQZZH2E8OuQNKhjne9Uyr0g%40mail.gmail.com.

Chris Harrelson

unread,
May 20, 2021, 2:47:01 PMMay 20
to Daniel Bratell, Victor Gomes, blink-dev
LGTM2, but please ping Webkit and Mozilla via bit.ly/blink-signals to inform them, encourage coordinated launch, and gather any late-breaking concerns.

Chris Harrelson

unread,
May 20, 2021, 3:16:21 PMMay 20
to Daniel Bratell, Victor Gomes, blink-dev
I take back my signals comment. I discussed with the other API owners, and we concluded you don't need to ask for signals in this case, since it's a stage 3 proposal.

Daniel Bratell

unread,
May 20, 2021, 3:17:49 PMMay 20
to Chris Harrelson, Victor Gomes, blink-dev

Btw, what has Firefox people said about the collision in the Error constructor?

/Daniel

Rick Byers

unread,
May 20, 2021, 3:23:47 PMMay 20
to Daniel Bratell, Chris Harrelson, Victor Gomes, blink-dev
LGTM3

I'm very glad to see this pattern coming to JS. I always thought this model worked quite well in practice in my previous life working with .NET.

Yulia Startsev

unread,
May 20, 2021, 4:03:32 PMMay 20
to Rick Byers, Daniel Bratell, Chris Harrelson, Victor Gomes, blink-dev
Daniel,

You asked about the collision in the error constructor on Firefox: We checked this pretty early on and it isn't an issue. The proposal uses an options bag as opposed to a number, and we just type check for that. We have an in progress implementation that should land soon.

Yulia

Daniel Bratell

unread,
May 21, 2021, 4:34:01 AMMay 21
to Yulia Startsev, Rick Byers, Chris Harrelson, Victor Gomes, blink-dev

Good that it doesn't cause any implementation problems!

/Daniel

Reply all
Reply to author
Forward
0 new messages