Re: [whatwg/webidl] Normative: Add DOMException cause (PR #1179)

@domenic commented on this pull request.

This looks good with a suggested nit.

However I had another doubt about the general shape here. Which is, should we really be installing an own data property? That's what `Error` does, but we've already decided to depart from `Error` for `name` and `message`, making those getters instead.

I lean slightly toward consistency with `DOMException`'s existing properties over consistency with `Error`, given how in the past I tried to encourage consistency with `Error` and failed (see https://github.com/whatwg/webidl/pull/378).

But this brings us to my next point, which is, it seems like it's time to ask for implementer support for this change. So let's try pinging: @yuki3, @EdgarChen, @petervanderbeken, and @shvaikalesh and see what they say, both on the general proposal and on whether we should do a data property or a readonly attribute (getter) for `cause`.

>  constructor steps are:
 
-1. Set [=this=]'s [=DOMException/name=] to |name|.
-1. Set [=this=]'s [=DOMException/message=] to |message|.
+1.  Set [=this=]'s [=DOMException/message=] to |message|.
+1.  If |options| is a string, then set [=this=]'s [=DOMException/name=] to |options|.
+1.  Otherwise,
+    1.  Set [=this=]'s [=DOMException/name=] to |options|["{{DOMExceptionOptions/name}}"].
+    1.  If |options|["cause"] [=map/exists=], then perform <a abstract-op>CreateNonEnumerableDataPropertyOrThrow</a>([=this=], "cause", |options|["cause"]).

```suggestion
    1.  If |options|["cause"] [=map/exists=], then perform <a abstract-op>CreateNonEnumerableDataPropertyOrThrow</a>([=this=], "`cause`", |options|["{{DOMExceptionOptions/cause}}"]).
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/pull/1179#pullrequestreview-1095891023
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/webidl/pull/1179/review/1095891023@github.com>

Received on Monday, 5 September 2022 06:11:30 UTC