In practice this is a lot of information though, and often it's a
coincidence that
the dispatch entry comes first since maps are unordered.

See the following error I found in practice using namespaced keywords
pervasively
missing a :spec-play.destruct/type|or method. It's rather large and
I'm glad the relevant entry came first.

CompilerException clojure.lang.ExceptionInfo: Call to
#'spec-play.destruct/parse-type did not conform to spec:
At: [:ret] val: {:spec-play.destruct/type|type :spec-play.destruct/type|or,
:spec-play.destruct/or|types [{:spec-play.destruct/type|type
:spec-play.destruct/type|N}]}
fails predicate: spec-play.destruct/type-type,  no method
:clojure.spec/args  ((clojure.core/or N))

Here are two ideas that might solve this:

1. Use the result of applying the dispatch function to the input in the
error message.
2. Allow custom error messages in the default method (ie. return something
more
interesting than nil).

Thanks,
Ambrose

On Wed, May 25, 2016 at 10:30 AM, Alex Miller <a...@puredanger.com> wrote:

> Rich pointed out that this is telling you the predicate
> :my.domain/event-type and the value it received: {:event/type
> :event/restart} which seems to be telling you everything you need to know
> wrt to the missing method.
>
> The dispatch method is opaque (even though it is simple here), so doesn't
> make sense to generically add anything additional to this message.
>
> On Tuesday, May 24, 2016 at 10:53:43 PM UTC-5, Ambrose Bonnaire-Sergeant
> wrote:
>>
>> Thanks for the guide Alex.
>>
>> Is it possible to get more information in the "no method" error returned
>> by
>> multi-spec?
>>
>> (s/explain :event/event {:event/type :event/restart})
>> ;; val: {:event/type :event/restart} fails predicate:
>> my.domain/event-type, no method
>>
>> It would be nice to mention exactly which method is missing here (ie.
>> :event/restart).
>>
>> Thanks,
>> Ambrose
>>
> --
> 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.
>

-- 
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