Documentation
¶
Overview ¶
Package fault defines the fault primitives that rules execute when they fire. Each fault implements Apply(ctx); a non-nil error short-circuits the adapter's Action.Before chain and is delivered to the caller in the adapter's native error model.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrConnDrop = errors.New("chaotic: connection drop")
ErrConnDrop is the sentinel returned by ConnDrop's Apply. Each adapter detects this sentinel via errors.Is and substitutes its native connection-drop error (driver.ErrBadConn, status.Unavailable, etc.).
Functions ¶
This section is empty.
Types ¶
type Fault ¶
Fault is one chaos primitive. Apply may sleep, return an error, or panic. A return of nil means the fault completed without affecting the call.
func ConnDrop ¶
func ConnDrop() Fault
ConnDrop returns ErrConnDrop. Each adapter detects this sentinel and substitutes its native connection-drop error.
func Error ¶
Error returns err verbatim from Apply. The adapter is responsible for wrapping it into its native error model (e.g., &url.Error{Op: "chaos"} for http). A nil err makes Apply a no-op.
func Jittered ¶
Jittered sleeps for a uniformly random duration in [min, max]. Negative or zero values are treated as "no sleep". If max <= min, sleeps for min.