The wasm.exceptions unit in FPC exposes 2 functions which allow you to retrieve exception information from the free pascal RTL. The default behaviour of the WASI hosting environment is to wrap all calls to a WebAssembly function and use these functions transform the exception to a EWasmNativeException exception.
The output below shows the result of catching this exception.