Class ThrowableContextDecorator

java.lang.Object
com.tnsai.exceptions.ThrowableContextDecorator

public final class ThrowableContextDecorator extends Object
Helper for the catch-side of framework boundaries.

When framework code catches a third-party throwable that doesn't extend TnsAIException, calling enrich(Throwable) attaches the current AgentContext via a ContextualWrapper so downstream logging / ErrorEmitter sees the correlation fields. TnsAIException instances pass through unchanged because they already capture context at construction.

Typical usage:


 try {
     httpClient.execute(request);
 } catch (IOException e) {
     // ContextualWrapper attaches current agent / role / session / tenant.
     throw ThrowableContextDecorator.enrich(e);
 }
 

enrich returns a RuntimeException so the caller can throw the result directly without changing the surrounding method signature.

Since:
0.5.0 (issue #90)