[whatwg/webidl] Allow users of "invoke a callback function" to report the exception (PR #1424)

This makes it more concise for users to, as is frequently desired for undefined-returning callbacks especially, immediately catch and report the exception rather than needing to handle it themselves.

This isn't appropriate for other types of callback functions, where a result may be expected or the exception needs to be rethrown. Callers need to explicitly decide which behavior they want, unless the callback returns a promise type, in which case exceptions are turned into rejected promises implicitly.

Fixes #1423.

<!--
Thank you for contributing to the Web IDL Standard! Please describe the change you are making and complete the checklist below if your change is not editorial.
When editing this comment after the PR is created, check that PR-Preview doesn't overwrite your changes.
If you think your PR is ready to land, please double-check that the build is passing and the checklist is complete before pinging.
-->

- [x] At least two implementers are interested (and none opposed): n/a; no normative change
- [x] [Tests](https://github.com/web-platform-tests/wpt) are written and can be reviewed and commented upon at: n/a; no normative change
- [x] [Implementation bugs](https://github.com/whatwg/meta/blob/main/MAINTAINERS.md#handling-pull-requests) are filed: n/a; no normative change
- [x] [MDN issue](https://github.com/whatwg/meta/blob/main/MAINTAINERS.md#handling-pull-requests) is filed: n/a; no normative change
- [x] The top of this comment includes a [clear commit message](https://github.com/whatwg/meta/blob/main/COMMITTING.md) to use. <!-- If you created this PR from a single commit, Github copied its message. Otherwise, you need to add a commit message yourself. -->

(See [WHATWG Working Mode: Changes](https://whatwg.org/working-mode#changes) for more details.)


<!--
    This comment and the below content is programmatically generated.
    You may add a comma-separated list of anchors you'd like a
    direct link to below (e.g. #idl-serializers, #idl-sequence):

    Don't remove this comment or modify anything below this line.
    If you don't want a preview generated for this pull request,
    just replace the whole of this comment's content by "no preview"
    and remove what's below.
-->
***
<a href="https://whatpr.org/webidl/1424.html" title="Last updated on Jul 31, 2024, 3:44 PM UTC (9ae367c)">Preview</a> | <a href="https://whatpr.org/webidl/1424/155ae10...9ae367c.html" title="Last updated on Jul 31, 2024, 3:44 PM UTC (9ae367c)">Diff</a>
You can view, comment on, or merge this pull request online at:

  https://github.com/whatwg/webidl/pull/1424

-- Commit Summary --

  * Allow users of "invoke a callback function" to report the exception

-- File Changes --

    M index.bs (22)

-- Patch Links --

https://github.com/whatwg/webidl/pull/1424.patch
https://github.com/whatwg/webidl/pull/1424.diff

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

Message ID: <whatwg/webidl/pull/1424@github.com>

Received on Wednesday, 31 July 2024 15:44:23 UTC