failjure icon indicating copy to clipboard operation
failjure copied to clipboard

Tuple destructuring inside attempt-all causes an exception because the Failure is not short-circuited early enough

Open TuggyNE opened this issue 2 years ago • 0 comments

Special case of #15: map destructuring works fine now, but tuple destructuring chokes.

Correctly returns either Failure or the expected values:

(f/attempt-all [{:keys [a b]}
                (if (< (rand) 0.5) (f/fail "test") {:a 1 :b 2})] [a b])

Throws UnsupportedOperationException when it doesn't return the expected values:

(f/attempt-all [[a b]
                (if (< (rand) 0.5) (f/fail "test") [1 2])] [a b])

TuggyNE avatar Jul 19 '22 17:07 TuggyNE