Enum Class HookFailurePolicy

java.lang.Object
java.lang.Enum<HookFailurePolicy>
com.tnsai.hooks.HookFailurePolicy
All Implemented Interfaces:
Serializable, Comparable<HookFailurePolicy>, Constable

public enum HookFailurePolicy extends Enum<HookFailurePolicy>
How the HookDispatcher handles a hook that throws or times out during apply (issue #58).

The choice is operator-driven: safety-critical deployments prefer FAIL_CLOSED so a broken hook blocks rather than silently allowing (the upstream invariant the hook enforces is too important to quietly skip). Dev-mode and best-effort deployments prefer FAIL_OPEN so a flaky hook doesn't take the system down.

Since:
0.5.0 (issue #58)
  • Enum Constant Details

    • FAIL_OPEN

      public static final HookFailurePolicy FAIL_OPEN
      Treat a failed hook as HookResult.Allow and continue the chain. Default for dev / best-effort deployments where availability matters more than every rule firing.
    • FAIL_CLOSED

      public static final HookFailurePolicy FAIL_CLOSED
      Treat a failed hook as HookResult.Block with reason "hook-failure". Default for safety-critical deployments where a broken rule must not let an operation through.
  • Method Details

    • values

      public static HookFailurePolicy[] 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

      public static HookFailurePolicy valueOf(String name)
      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 name
      NullPointerException - if the argument is null