I was writing a small function to traverse a binary tree and due to an extra parentheses somewhere in the code I kept getting the following error:
Execution error (Error) at (<cljs repl>:1).
Invalid arity: 0
Without any hint on the line or in the macro/function that the erroneous function call happened it was very hard to find the mistake. I eventually did find it after a few hours but it would be great if the error message was more descriptive and could include some more details.
Unfortunately, I don't have experience with the ClojureScript compile or internal implementation of the macros so I don't really know if there even exists any information during runtime that could be useful but I thought it would be great to expose it if there was.
My initial hunch is that we should make this scenario behave like Clojure 1.10.1 (putting more details into a temp edn file that is referenced when the exception summary is printed).
I was writing a small function to traverse a binary tree and due to an extra parentheses somewhere in the code I kept getting the following error:
Without any hint on the line or in the macro/function that the erroneous function call happened it was very hard to find the mistake. I eventually did find it after a few hours but it would be great if the error message was more descriptive and could include some more details.
Unfortunately, I don't have experience with the ClojureScript compile or internal implementation of the macros so I don't really know if there even exists any information during runtime that could be useful but I thought it would be great to expose it if there was.
The code throwing this error is below:
After saving the above into
repro.cljs
, running the code withplk repro.cljs
will generate the error.The problem is an extra pair of parentheses for the
:else
clause, so removing those fixes the problem and the code runs fine.Thanks a lot.