Package com.tnsai.hooks.external
Enum Class ScriptFailurePolicy
- All Implemented Interfaces:
Serializable,Comparable<ScriptFailurePolicy>,Constable
What an
ExternalScriptHook does when the subprocess fails
(timeout, non-zero exit, unparseable response) (issue #64).
Distinct from HookFailurePolicy which is
the HookDispatcher-wide policy covering in-process
exceptions from Java hooks. ScriptFailurePolicy is per
external-hook and targets the subprocess-specific failure surface:
non-zero exit, missing stdout, timeout, malformed JSON.
- Since:
- 0.5.0 (issue #64)
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Enum
Enum.EnumDesc<E extends Enum<E>> -
Enum Constant Summary
Enum Constants -
Method Summary
Modifier and TypeMethodDescriptionstatic ScriptFailurePolicyReturns the enum constant of this class with the specified name.static ScriptFailurePolicy[]values()Returns an array containing the constants of this enum class, in the order they are declared.Methods inherited from class java.lang.Enum
compareTo, describeConstable, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
-
Enum Constant Details
-
FAIL_OPEN
On failure, behave asAllow— chain continues. Use for advisory hooks where availability matters more than every rule firing.Today: the implementation logs every failure at WARN regardless of policy; FAIL_OPEN's intent is "future-proofing for log-volume tuning where flaky scripts should not spam the log". Functionally identical to
LOG_AND_ALLOWin this release; the distinction is preserved as a label so consumers signal intent at config time. -
FAIL_CLOSED
On failure, behave asBlock— chain stops. Use for safety-critical hooks where a broken script must not let an operation through. -
LOG_AND_ALLOW
Default: on failure, log a structured warning event and allow the chain to continue. The safest production default — a flaky script doesn't take the system down, but operators still see the failure in logs / alerts.
-
-
Method Details
-
values
Returns an array containing the constants of this enum class, in the order they are declared.- Returns:
- an array containing the constants of this enum class, in the order they are declared
-
valueOf
Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException- if this enum class has no constant with the specified nameNullPointerException- if the argument is null
-