Re: [whatwg/webidl] What's the idiomatic way to reject a promise with structured data? (Issue #1223)

Yes, that's the idea! Be sure to follow the full pattern shown in #1211, including the guidance in the following:

```html
*   The [=identifier=] of the [=interface=] must end with <code>Error</code>, and must not be any
    of the names in the <a><code>DOMException</code> names table</a>.
*   The [=interface=] must have a [=constructor operation=] which sets the instance's
    [=DOMException/name=] to the interface's [=identifier=].
*   Their [=constructor operation=] must take as its first parameter an [=optional=] {{DOMString}}
    named |message| defaulting to the empty string, and must set the instance's
    [=DOMException/message=] to |message|.
*   Their [=constructor operation=] should take as its second parameter a [=dictionary=] containing
    the additional information that needs to be exposed.
*   They should have [=read only=] [=attributes=], whose names are the same as the members of the
    constructor dictionary, which return the values accepted by the constructor operation.
*   They should be [=serializable objects=], whose [=serialization steps=] and
    [=deserialization steps=] preserve the additional information.
```

(The PR also contains a full example of how to do this.)

Actually merging that PR is blocked on a tooling issue (https://github.com/plinss/widlparser/issues/79), but you can follow its example ahead of time with no issues.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/webidl/issues/1223#issuecomment-1298009309
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/webidl/issues/1223/1298009309@github.com>

Received on Tuesday, 1 November 2022 04:22:51 UTC