refined icon indicating copy to clipboard operation
refined copied to clipboard

Better error message when a value doesn't satisfy the predicate

Open fthomas opened this issue 8 years ago • 3 comments

This tweet https://twitter.com/ppurang/status/674252856720031745 indicates that we could improve the error message when a value doesn't satisfy the predicate.

fthomas avatar Dec 12 '15 12:12 fthomas

I tend to change the error message from Predicate failed: (4 > 6) to something like Predicate failed: (x > 6) where x = 4. That should help to keep apart the predicate and the value that didn't satisfy it.

fthomas avatar Mar 23 '16 21:03 fthomas

One more example of a strange error message:

@ string.NonEmptyString.from("foo") 
res2: Either[String, string.NonEmptyString] = Right(foo)

@ string.NonEmptyString.from("") 
res3: Either[String, string.NonEmptyString] = Left("Predicate isEmpty() did not fail.")

LMnet avatar Mar 02 '19 05:03 LMnet

Yes, I was misled today by this strange error message - it expresses the opposite of the actual problem.

SinarPandora avatar Jul 12 '23 08:07 SinarPandora