e01.org

WebAssembly exception handling instructions

WebAssembly exception handling instructions.

WebAssembly exception handling instructions.

## Throw

- [`throw`](/docs/WebAssembly/Reference/Exception_handling/throw)
- : Throws an exception of a specified type, as defined by a [`tag`](/docs/WebAssembly/Reference/Definitions/tag) definition.
- [`throw_ref`](/docs/WebAssembly/Reference/Exception_handling/throw_ref)
- : Rethrows a previously-thrown exception represented by an [`exnref`](/docs/WebAssembly/Reference/Value_types/exnref) value.

## Try

- [`try_table`](/docs/WebAssembly/Reference/Exception_handling/try_table)
- : Enables you to test a block of code to see whether it throws an exception, handling the exception with a [catch clause](#catch_clauses) if so.

### Catch clauses

- [`catch`](/docs/WebAssembly/Reference/Exception_handling/try_table/catch)
- : Catches exceptions matching a specified error `tag`, pushing the exception payload to the stack.
- [`catch_all`](/docs/WebAssembly/Reference/Exception_handling/try_table/catch_all)
- : Catches any exception and pushes nothing to the stack.
- [`catch_ref`](/docs/WebAssembly/Reference/Exception_handling/try_table/catch_ref)
- : Catches exceptions matching a specified error `tag`, pushing the exception payload and an [`exnref`](/docs/WebAssembly/Reference/Value_types/exnref) value representing the exception to the stack.
- [`catch_all_ref`](/docs/WebAssembly/Reference/Exception_handling/try_table/catch_all_ref)
- : Catches any exception and pushes an `exnref` value representing the exception to the stack.

## See also

- [`exnref`](/docs/WebAssembly/Reference/Value_types/exnref) type
- [`tag`](/docs/WebAssembly/Reference/Definitions/tag) definition
- [`WebAssembly.Exception`](/docs/WebAssembly/Reference/JavaScript_interface/Exception) JavaScript interface
- [`WebAssembly.Tag`](/docs/WebAssembly/Reference/JavaScript_interface/Tag) JavaScript interface

source: MDN Web Docs mirror · page

Cite this

"WebAssembly exception handling instructions". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/WebAssembly/Reference/Exception_handling

JSON record · API collection · citation policy