Aren't people already doing something like this with Mozilla's pure JS source map implementation? Seems to me you could just load the source map at runtime and sort it out.
David On Thu, Jun 26, 2014 at 4:38 AM, Dylan Butman <[email protected]> wrote: > I'm working on a fun interactive documentation system for an Om app. The idea > is that functions and components submit messages similar to doc strings to a > documentation channel that prints the manages printing the messages to the > console along with additional information. I'd love to include the line > numbers that the messages are submitted from. > In the past I've gotten printable stack traces in javascript by creating > errors and printing them (instead of throwing). > > In cljs, if you > > (defn stack-trace [] > (throw)) > (stack-trace) > > with :optimization :none :source-maps true > > in the js console you see (in chrome) > > Uncaught null > stack-trace my-file.cljs:line# > (anonymous function) > > if you > (defn stack-trace [] > (.-stack (js/Error.))) > (.log js/console (stack-trace) > > you see > > Error > at stack-trace (http://localhost:3000/js/out/my-file.js:line#:col#) > at http://localhost:3000/js/out/my-file.js:line#:col# > my-file.cljs:line# > > this is great in the console. But is it possible to get the line# of the > function call directly? > > -- > Note that posts from new members are moderated - please be patient with your > first post. > --- > You received this message because you are subscribed to the Google Groups > "ClojureScript" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/clojurescript. -- Note that posts from new members are moderated - please be patient with your first post. --- You received this message because you are subscribed to the Google Groups "ClojureScript" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/clojurescript.
