View Source Bond.PropertyTest.FilterTooRestrictiveError exception (Bond v1.9.0)

Raised by Bond.PropertyTest.probe_contract/2 when a function's precondition is so restrictive that StreamData discards too many consecutive generated inputs before finding enough that satisfy @pre.

probe_contract/2 uses the precondition as a filter: generated inputs that violate @pre are discarded rather than failing the property. When almost every generated value is discarded, StreamData gives up with its generic StreamData.FilterTooNarrowError. Bond rescues that and re-raises this error instead, naming the function whose precondition did the filtering and pointing at the usual fixes — so the message is actionable rather than a bare "too many filtered".

The fix is almost always to make the base generators produce valid inputs more often: narrow them to the precondition's domain, or use StreamData.bind/2 to build inputs that satisfy a relational precondition (e.g. amount <= account.balance), which boundary injection can't probe for you.

Summary

Types

@type t() :: %Bond.PropertyTest.FilterTooRestrictiveError{
  __exception__: term(),
  arity: non_neg_integer(),
  function: atom(),
  last_generated_value: {:value, term()} | :none,
  module: module()
}