Class PanamaExceptionHandler
java.lang.Object
ai.tegmentum.wasmtime4j.panama.experimental.PanamaExceptionHandler
- All Implemented Interfaces:
ai.tegmentum.wasmtime4j.experimental.ExceptionHandler,AutoCloseable
public final class PanamaExceptionHandler
extends Object
implements ai.tegmentum.wasmtime4j.experimental.ExceptionHandler
Panama implementation of WebAssembly exception handling.
This class provides Panama Foreign Function API bindings for WebAssembly exception handling, integrating with the native Rust implementation while ensuring proper resource management and defensive programming practices.
- Since:
- 1.0.0
-
Nested Class Summary
Nested classes/interfaces inherited from interface ai.tegmentum.wasmtime4j.experimental.ExceptionHandler
ai.tegmentum.wasmtime4j.experimental.ExceptionHandler.ExceptionHandlingConfig, ai.tegmentum.wasmtime4j.experimental.ExceptionHandler.ExceptionTag, ai.tegmentum.wasmtime4j.experimental.ExceptionHandler.HandlingResult -
Method Summary
Modifier and TypeMethodDescriptioncaptureStackTrace(long tagHandle) voidclose()static PanamaExceptionHandlercreate()Creates a new Panama exception handler with default configuration.static PanamaExceptionHandlercreate(ai.tegmentum.wasmtime4j.experimental.ExceptionHandler.ExceptionHandlingConfig config) Creates a new Panama exception handler with the specified configuration.static PanamaExceptionHandlercreate(ai.tegmentum.wasmtime4j.experimental.ExceptionHandler.ExceptionHandlingConfig config, String handlerName) Creates a new Panama exception handler with the specified configuration and name.ai.tegmentum.wasmtime4j.experimental.ExceptionHandler.ExceptionTagcreateExceptionTag(String name, List<ai.tegmentum.wasmtime4j.WasmValueType> parameterTypes) ai.tegmentum.wasmtime4j.experimental.ExceptionHandler.ExceptionHandlingConfigOptional<ai.tegmentum.wasmtime4j.experimental.ExceptionHandler.ExceptionTag> getExceptionTag(String name) Gets the native memory segment handle.ai.tegmentum.wasmtime4j.experimental.ExceptionHandler.ExceptionTaggetTagByHandle(long tagHandle) Gets a cached exception tag by handle.ai.tegmentum.wasmtime4j.experimental.ExceptionHandler.HandlingResultbooleanisClosed()Checks if this handler is closed.booleanList<ai.tegmentum.wasmtime4j.experimental.ExceptionHandler.ExceptionTag> booleanperformUnwinding(int currentDepth) voidsetEnabled(boolean enabled) Enables or disables this exception handler.
-
Method Details
-
create
Creates a new Panama exception handler with default configuration.- Returns:
- a new exception handler
-
create
public static PanamaExceptionHandler create(ai.tegmentum.wasmtime4j.experimental.ExceptionHandler.ExceptionHandlingConfig config) Creates a new Panama exception handler with the specified configuration.- Parameters:
config- the exception handling configuration- Returns:
- a new exception handler
- Throws:
NullPointerException- if config is null
-
create
public static PanamaExceptionHandler create(ai.tegmentum.wasmtime4j.experimental.ExceptionHandler.ExceptionHandlingConfig config, String handlerName) Creates a new Panama exception handler with the specified configuration and name.- Parameters:
config- the exception handling configurationhandlerName- the handler name- Returns:
- a new exception handler
- Throws:
NullPointerException- if config or handlerName is null
-
handle
public ai.tegmentum.wasmtime4j.experimental.ExceptionHandler.HandlingResult handle(Throwable exception) - Specified by:
handlein interfaceai.tegmentum.wasmtime4j.experimental.ExceptionHandler
-
getHandlerName
- Specified by:
getHandlerNamein interfaceai.tegmentum.wasmtime4j.experimental.ExceptionHandler
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabledin interfaceai.tegmentum.wasmtime4j.experimental.ExceptionHandler
-
setEnabled
public void setEnabled(boolean enabled) Enables or disables this exception handler.- Parameters:
enabled- true to enable, false to disable
-
createExceptionTag
-
getExceptionTag
-
listExceptionTags
- Specified by:
listExceptionTagsin interfaceai.tegmentum.wasmtime4j.experimental.ExceptionHandler
-
captureStackTrace
- Specified by:
captureStackTracein interfaceai.tegmentum.wasmtime4j.experimental.ExceptionHandler
-
performUnwinding
public boolean performUnwinding(int currentDepth) - Specified by:
performUnwindingin interfaceai.tegmentum.wasmtime4j.experimental.ExceptionHandler
-
getConfig
public ai.tegmentum.wasmtime4j.experimental.ExceptionHandler.ExceptionHandlingConfig getConfig()- Specified by:
getConfigin interfaceai.tegmentum.wasmtime4j.experimental.ExceptionHandler
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceai.tegmentum.wasmtime4j.experimental.ExceptionHandler
-
getTagByHandle
public ai.tegmentum.wasmtime4j.experimental.ExceptionHandler.ExceptionTag getTagByHandle(long tagHandle) Gets a cached exception tag by handle.- Parameters:
tagHandle- the tag handle- Returns:
- the exception tag, or null if not found
-
getNativeHandle
Gets the native memory segment handle.- Returns:
- the native handle
-
isClosed
public boolean isClosed()Checks if this handler is closed.- Returns:
- true if closed
-