void maybeThrowTrap()

in wasm/lib/src/runtime.g.dart [680:701]


  void maybeThrowTrap(Pointer<WasmerTrap> trap, String source) {
    if (trap != nullptr) {
      // There are 2 kinds of trap, and their memory is managed differently.
      // Traps created in the newTrap method below are stored in the traps map
      // with a corresponding exception, and their memory is managed using a
      // finalizer on the _WasmTrapsEntry. Traps can also be created by WASM
      // code, and in that case we delete them in this function.
      final trapMessage = calloc<WasmerByteVec>();
      _trap_message(trap, trapMessage);
      final message = trapMessage.ref.toString();
      _byte_vec_delete(trapMessage);
      calloc.free(trapMessage);
      final entry = _traps.remove(message);
      if (entry == null) {
        throw WasmError(
          'This case is not (yet) supported. Please file an issue on pkg:wasm.',
        );
      }
      // ignore: only_throw_errors
      throw entry.exception;
    }
  }