Hi Francois,

There have been a few threads about this on the plumbing mailing list, and
there's an ongoing thread on Github as well.

https://github.com/Prismatic/schema/pull/134#issuecomment-52088191

The upshot is that it's a fundamental limitation of `either` that it can't
provide good error messages, because it doesn't know which schema any
particular data is "supposed to" be validated against.   I would highly
encourage you to use `s/if`, `s/cond`, or other options instead -- they
will provide much better error messages out of the box, and are more
efficient to boot.

FWIW, `either` used to actually print the schemas as you mention, but we
actually found that in most cases it made errors *more difficult* to
understand because the list of huge schemas obscured the context of the
error, which was typically much more useful.

-Jason


On Wed, Aug 13, 2014 at 6:19 AM, François Rey <fmj...@gmail.com> wrote:

>  The resulting message is generated by the walk method of the s/Either
> record, see this line:
>
> https://github.com/Prismatic/schema/blob/ce582d1602abde47143a618745cdd079e0cdaf44/src/cljx/schema/core.cljx#L437
>
> Perhaps removing the quote before 'schemas would make the message clearer:
>
> (list 'some (list 'check '% (utils/value-name x)) schemas))
>
>
> That would be a quick fix to avoid a strange message, and may have been
> what was intended originally (typo bug?).
> Otherwise one would have to change the logic, perhaps by accumulating the
> result of walking each contained schema and combine them perhaps like this:
>
> (conj 'or res)
>
>
> the idea being to display a list of test for each schema or'ed together.
>
> I'm copying this in the prismatic mailing list for the record, perhaps
> Jason has further comments on this.
>
> François
>
> --
> You received this message because you are subscribed to the Google Groups
> "Plumbing and Graph: the Clojure utility belt" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to prismatic-plumbing+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to