On Tuesday, April 12, 2016 at 9:21:44 PM UTC-7, Mike Fikes wrote:
> Planck essentially takes advantage of this to print warning messages in a 
> different color, so it definitely:
> 
> 
> 
> cljs.user=> (+ n 5)
> WARNING: Use of undeclared Var cljs.user/n at line 1 
> NaN
> 
> So, yeah, that works. The problem is that you might have other things going 
> out the err stream.
> 
> 
> 
> cljs.user=> (binding [*print-fn* *print-err-fn*]
>        #_=>  (println "Danger, Will Robinson!"))
> Danger, Will Robinson!
> nil
> 
> 
> Hooking into the custom warning handler machinery via *cljs-warning-handlers* 
> might be a cleaner route, if you need finer-grained control of things. (I’m 
> presuming this mechanism would work in self-host, but I’ve never tried it.)
> 
> 
> (Jake McCrary has a good exposition on the subject: 
> http://jakemccrary.com/blog/2015/12/19/clojurescript-treat-warnings-as-errors/).
> 

Thanks; I'll investigate this further.
> 
> - Mike
> 
> 
> 
> On Apr 12, 2016, at 9:41 PM, J David Eisenberg <jdavid.e...@gmail.com> wrote:
> 
> 
> If I evaluate this expression without defining a variable n:
> 
>    (+ n 5)
> 
> I get this in my console.log:
> 
>    WARNING: Use of undeclared Var cljs.user/n at line 1 
> 
> and the result is NaN.
> 
> I would like to capture the warning message so I can show it to the end user. 
> When I take out (enable-console-print!) I get this message:
> 
>   Error: No *print-err-fn* fn set for evaluation environment
> 
> so I presume I should be able to put in my own *print-err-fn* to intercept 
> the warning message. Am I on the right track?
> 
[snip]

-- 
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 clojurescript+unsubscr...@googlegroups.com.
To post to this group, send email to clojurescript@googlegroups.com.
Visit this group at https://groups.google.com/group/clojurescript.

Reply via email to