Package com.tnsai.guardrails
Class GuardrailViolationException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.tnsai.guardrails.GuardrailViolationException
- All Implemented Interfaces:
Serializable
Thrown by
InputGuardrailEnforcer or
OutputGuardrailEnforcer when an action's declared guardrail
is breached and the onFailure policy requires aborting the
action.
When enforcement runs through ActionExecutor, it is wrapped into an
ActionExecutionException of category
VALIDATION. Direct callers of other enforcement boundaries, including
ToolMethodDispatcher, receive this exception as-is.
GuardrailViolationException.Stage distinguishes input-side from output-side failures
for telemetry / logging; parameterName() (input) or
"<output>" (output) identifies the offending payload. Input
enforcement omits a parameter name when the name itself is rejected, so
diagnostics never copy a PII-shaped key.
- Since:
- 0.5.4 (issue #171, Phase 1)
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumWhy the value was rejected.static enumWhether the violation occurred before or after action execution. -
Constructor Summary
ConstructorsConstructorDescriptionGuardrailViolationException(GuardrailViolationException.Stage stage, GuardrailViolationException.Cause cause, String actionName, String parameterName, String message) -
Method Summary
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
GuardrailViolationException
public GuardrailViolationException(GuardrailViolationException.Stage stage, GuardrailViolationException.Cause cause, String actionName, String parameterName, String message)
-
-
Method Details
-
stage
-
guardrailCause
-
parameterName
-
actionName
-