<< Back to previous view

[CLJS-469] Bad Exception message when multimethod has no dispatch-fn Created: 12/Feb/13  Updated: 02/Dec/14  Resolved: 02/Dec/14

Status: Closed
Project: ClojureScript
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Defect Priority: Major
Reporter: Thomas Heller Assignee: Unassigned
Resolution: Completed Votes: 0
Labels: None

Attachments: File multi-fn-inamed.diff    
Patch: Code

 Description   

When a multi-fn has no dispatch method for a given value the current exception string prints the cljs.core/name function instead of the actual name of the mf. Minor bug but makes it kinda hard to track down which multi-fn actually failed to dispatch.

The attached patch fixes that but directly accessing the name property of the multi-fn which is not very clean but better than the current error. AFAICT cljs doesnt have the clojure.lang.Named protocol, which would probably be cleaner.



 Comments   
Comment by Thomas Heller [ 12/Feb/13 6:12 AM ]

Corrected the .patch

Comment by David Nolen [ 19/Feb/13 8:54 AM ]

ClojureScript now has an INamed protocol

Comment by Thomas Heller [ 20/Feb/13 3:42 PM ]

Updated the .patch to implement INamed for cljs.core/MultiFn, turning its name into a real symbol.

Tests pass but I dont know if that part of the code is actually tested.

Comment by Thomas Heller [ 20/Feb/13 3:43 PM ]

Oh, I'm not quite sure that the way I resolved the namespace for the symbol is totally correct. It works but I had to dig a bit.

Comment by David Nolen [ 02/Dec/14 6:28 AM ]

Rebased patch welcome, thanks!

Comment by Thomas Heller [ 02/Dec/14 7:44 AM ]

Uh, forgot about this. The important part of this issue was fixed a while back, the exception no long contains the source code to the cljs.core/name function.

The name however still is not fully qualified, updated the patch to only contain the INamed implementation for cljs.core/MultiFn so it will correctly report its full name.

Comment by David Nolen [ 02/Dec/14 7:47 AM ]

fixed https://github.com/clojure/clojurescript/commit/c926c13f052161cb0ae161d814442f677bf013f1

Generated at Sat Dec 20 04:31:38 CST 2014 using JIRA 4.4#649-r158309.