Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add exception paragraph to JSPI article #703

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/blog/jspi.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ However, as with other Promise-style APIs in the browser, any time the WebAssemb

JavaScript already has a well developed mechanism for representing asynchronous computations: the Promise and the `async` function notation. The JSPI is designed to integrate well with this but not to replace it.

### How do I deal with exceptions?

To avoid having to deal with JSPI exceptions, you will probably want to avoid exposing your promise rejections to JSPI at all. That can be done by using `.then()` to attach a rejection handler that returns the rejected promise into a successfully resolved promise that carries the error code your application is expecting.

### Next steps

The JSPI is currently experimental–one should not use it for Web applications that are intended to be deployed in production. However, it is a _standard track_ effort; which means that it will eventually become a standard and we expect this to become a standard implemented across all major browsers.
Expand Down
Loading