[CLJ-1394] Print multi method dispatch values in the exception messages. Created: 31/Mar/14 Updated: 01/Apr/14
|Patch:||Code and Test|
The error messages of defmulti are at the moment not as helpful as they could be under certain circumstances. Calling this multi method with a lazy seq as it's dispatch argument raises the following exception:
Sometimes it would be useful to actually see which values are in the lazy seq being dispatched on. A better error message could look like
This patch addresses this issue by formatting the dispatch value via `pr-str` and printing the class before it is passed to the exception constructor. The same is also done for the methods in MultiFn.java that throw a dispatch value as part of their exception message.
|Comment by Nicola Mometto [ 31/Mar/14 8:22 PM ]|
What if the value is infinite lazy-seq?
|Comment by Roman Scherer [ 01/Apr/14 2:50 AM ]|
Nicola, I forgot those. But I think infinite sequences could be handled with:
I'll try it out and will update the patch later.
Any other edge cases in mind?
|Comment by Roman Scherer [ 01/Apr/14 2:28 PM ]|
After having read "Controlling run-away trains, onions, and exercise
However I'm not sure if this helps in the following case, where
The above doesn't terminate in Clojure 1.6.0, nor does it when binding