expound

2019-07-04T10:24:48.003400Z

Hi all, is there a good way to a) use custom opts (disabling printing specs) b) use expound to format some but not all spec errors (only the ones intended to be read by operators of the system) Browsing through the code it seems that you can only set custom-opts via set! or alter-var-root with custom-printer which would effect all spec errors

bbrinck 2019-07-04T14:58:09.004600Z

@dev964 Are you looking to use spec to print out instrumentation errors or errors on some data that you have in your program?

bbrinck 2019-07-04T14:58:51.005800Z

e.g. checking some data that incoming from another part of the system

2019-07-04T14:58:59.006Z

the second one

2019-07-04T14:59:10.006500Z

and I ended up not using expound in the end …

bbrinck 2019-07-04T14:59:15.006700Z

Would binding work in your case?

(binding [s/*explain-out* (expound/custom-printer {:show-valid-values? true})]
    (s/explain (s/coll-of string?) ["" "" 3]))

bbrinck 2019-07-04T14:59:40.007600Z

That would apply the custom settings only for the block of the binding

2019-07-04T14:59:44.008Z

yes, would work - but it was easier to construct the messages myself this time

bbrinck 2019-07-04T15:00:12.008600Z

Ah, OK, sounds good!

bbrinck 2019-07-04T15:01:19.009700Z

In a future version, you’ll be able to do (expound/expound (s/coll-of string?) ["" "" 3] {:show-valid-values? true}) to add the options inline, but I haven’t released that yet

👍 1
bbrinck 2019-07-04T15:01:25.010Z

In any case, glad you found a solution!