Package io.roastedroot.proxywasm
Class WasmException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- io.roastedroot.proxywasm.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 inMetricsHandler
,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 aWasmException
containing the appropriateWasmResult
.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 Summary
Constructors Constructor Description WasmException(io.roastedroot.proxywasm.internal.WasmResult result)
Constructs a new WasmException with the specified result code.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description io.roastedroot.proxywasm.internal.WasmResult
result()
Gets the underlyingWasmResult
code associated with this exception.-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
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 theWasmResult
.- Parameters:
result
- TheWasmResult
representing the outcome or error condition.
-
-