Fork me on GitHub

I find it tricky to quickly find the cause when I get “clojure.lang.ExceptionInfo: Couldn’t satisfy such-that predicate after 100 tries. {}” back from generators. I can find it using binary search but is there a better technique for debugging these generator errors?


@steveb8n is this a (gen/such-that ...) that you wrote yourself, or that spec wrote for you?


@gfredericks using gens from specs (I hardly ever use such-that gens). To me this is the hardest part of using generators so any tricks (or context data in the error) would help


@steveb8n there's a ticket somewhere describing that problem I think -- I added extra optional args to gen/such-that so that spec could add explanatory information to exceptions, but I don't believe that's been taken advantage of by spec.


and in any case it's only released in the alpha versions 😕


someday I should just give up and release whatever's on master so at least there's not that problem anymore


hah, I thought this might be the case. I also thought that providing useful debug data would be tricky since specs can vary wildly. in lieu of that, how do you hunt these down? binary search (with knowledge of the specs to guide you) or some other cleverness?


I haven't personally used spec a lot I think knowing that s/and is the most likely culprit is usually helpful


and thinking about generation whenever you write s/and in the first place


true that. I am using s/and extensively. I’ll ponder that a little. Thanks.

👍 4