Skip to content

Commit 21f4ae0

Browse files
author
Phosra
authored
Clarify that stack traces are not required (WebAssembly#216)
Fixes WebAssembly#215. This should indicate that an engine is still conforming if it does not attach a stack trace, even if `traceStack` is requested by JavaScript code (by setting it to `true`).
1 parent 74e7aa6 commit 21f4ae0

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

proposals/exception-handling/Exceptions.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ The following additional classes are added to the JS API in order to allow
424424
JavaScript to interact with WebAssembly exceptions:
425425

426426
* `WebAssembly.Tag`
427-
* `WebAssembly.Exception`.
427+
* `WebAssembly.Exception`
428428

429429
The `WebAssembly.Tag` class represents a typed tag defined in the tag section
430430
and exported from a WebAssembly module. It allows querying the type of a tag
@@ -449,12 +449,15 @@ check ensures that without access to a WebAssembly module's exported exception
449449
tag, the associated data fields cannot be read.
450450

451451
The `Exception` constructor can take an optional `ExceptionOptions` argument,
452-
which can optionally contain `traceStack` entry. When `traceStack` is `true`,
453-
web VMs can attach a stack trace string to `Exception.stack` field, as in
454-
JavaScript's `Error` class. While `Exception` is not a subclass of JavaScript's
452+
which can optionally contain `traceStack` entry. When `traceStack` is
453+
`true`, JavaScript VMs are permitted to attach a stack trace string to
454+
`Exception.stack` field, as in JavaScript's `Error` class. `traceStack`
455+
serves as a request to the WebAssembly engine to attach a stack trace; it
456+
is not necessary to honour if `true`, but `trace` may not be populated if
457+
`traceStack` is `false`. While `Exception` is not a subclass of JavaScript's
455458
`Error` and it can be used to represent normal control flow constructs,
456-
`traceStack` field can be set when we use it to represent errors. The format of
457-
stack trace strings conform to the [WebAssembly stack trace
459+
`traceStack` field can be set when we use it to represent errors. The
460+
format of stack trace strings conform to the [WebAssembly stack trace
458461
conventions](https://webassembly.github.io/spec/web-api/index.html#conventions).
459462
When `ExceptionOption` is not provided or it does not contain `traceStack`
460463
entry, `traceStack` is considered `false` by default.

0 commit comments

Comments
 (0)