The getArg()
prototype method of the Exception
object can be used to get the value of a specified item in the exception's data arguments.
The method passes a WebAssembly.Tag
and will only succeed if the thrown Exception
was created using the same tag, otherwise it will throw a TypeError
. This ensures that the exception can only be read if the calling code has access to the tag. Tags that are neither imported into or exported from the WebAssembly code are internal, and their associated WebAssembly.Exception
cannot be queried using this method!
Note: It is not enough that the tag has an identical sequence of data types — it must have the same identity (be the same tag) as was used to create the exception.