Class WasmException

  • All Implemented Interfaces:
    Serializable

    public class WasmException
    extends Exception
    An exception used to signal specific outcomes or errors from host functions back to the calling Proxy-WASM module.

    This exception wraps a WasmResult enum value, which corresponds to the standard result codes defined in the Proxy-WASM ABI specification. When a host function (like those defined in MetricsHandler, SharedQueueHandler, etc.) needs to return a status other than simple success (which is often indicated by a void return or a non-exceptional return value), it throws a WasmException containing the appropriate WasmResult.

    The runtime catches this exception and translates its contained WasmResult into the integer value expected by the WASM module according to the ABI.

    See Also:
    Serialized Form
    • Constructor Detail

      • WasmException

        public WasmException​(io.roastedroot.proxywasm.internal.WasmResult result)
        Constructs a new WasmException with the specified result code. The exception message is automatically set to the description of the WasmResult.
        Parameters:
        result - The WasmResult representing the outcome or error condition.
    • Method Detail

      • result

        public io.roastedroot.proxywasm.internal.WasmResult result()
        Gets the underlying WasmResult code associated with this exception.
        Returns:
        The non-null WasmResult enum value.