diff --git a/src/Hedgehog/Property.fs b/src/Hedgehog/Property.fs index a2f8e4d5..2ec927c2 100644 --- a/src/Hedgehog/Property.fs +++ b/src/Hedgehog/Property.fs @@ -78,8 +78,11 @@ module Property = | Success x -> GenTuple.mapFst (Journal.append journal) (k x)) + let private handle (e : exn) = + Gen.constant (Journal.singletonMessage (string e), Failure) |> ofGen + let bind (k : 'a -> Property<'b>) (m : Property<'a>) : Property<'b> = - bindGen (toGen << k) (toGen m) |> ofGen + bindGen (fun a -> (try k a with e -> handle e) |> toGen) (toGen m) |> ofGen let private printValue (value) : string = // sprintf "%A" is not prepared for printing ResizeArray<_> (C# List) so we prepare the value instead