A quick cheatsheet of approaches to debug ClojureScript code I’ve found useful.
Error messages and Source Maps
Wrong number of args (0) passed to cljs.core/map at line 31 /Users/roman01la/projects/om-react/src/om_react/core.cljs
TIP: Use Figwheel. Because it’s an incredible productivity booster and it nicely logs out compilation errors into the browser.
Sometimes you want to use plain old console.log. You can do it in two ways in ClojureScript.
Or use ClojureScript’s println:
With source maps enabled you can inspect ClojureScript code in DevTools and set a breakpoint. But in certain cases it would fail to stop on that breakpoint. Even though it stops, a call stack and variable names are not helpful all the time.
Bonus: in Chrome’s DevTools ClojureScript is automatically syntax highlighted.
dirac is a DevTools fork which is developed specifically for ClojureScript development needs.
Also Closure Library’s debug utility has a list of interesting features. I’m not aware about it, but it might be worth to give it a try.