On 05/15/2016 06:39 PM, Kevin Downey wrote: > On 05/14/2016 09:31 PM, cameron wrote: >> I'm having an issue where :default catch blocks are not working in >> clojurescript when in a go block. >> >> The following code prints "a str" as expected: >> >> (prn (try >> (throw "a str") >> (catch :default e e ))) >> >> The same code in a go block results in an unhandled exception >> (go (prn (try >> (throw "a str") >> (catch :default e e )))) >> >> I can see an old core.async issue that added support for :default >> (http://dev.clojure.org/jira/browse/ASYNC-42) >> but no other references, is this a regression or something I'm missing? >> >> I'm using clojurescript "1.8.51" and core.async "0.2.374" >> >> Cameron. >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To post to this group, send email to clojure@googlegroups.com >> Note that posts from new members are moderated - please be patient with >> your first post. >> To unsubscribe from this group, send email to >> clojure+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/clojure?hl=en >> --- >> You received this message because you are subscribed to the Google >> Groups "Clojure" group. >> To unsubscribe from this group and stop receiving emails from it, send >> an email to clojure+unsubscr...@googlegroups.com >> <mailto:clojure+unsubscr...@googlegroups.com>. >> For more options, visit https://groups.google.com/d/optout. > > You will likely find that (throw (js/String. "a str")) will work the > same in both. > > This issue has two parts: > > 1. String literals are somehow not objects or something in javascript (I > don't entirely understand this, but I vaguely recall that it is a thing) > > 2. The go macro uses js/Object as the exception type in the "catch all" > exception handler it creates to emulate exception handling. > > You can verify that the combination of these two things causes this > problem by playing with this code: > > (try (throw "foo") (catch js/Object e :good)) > > (try (throw (js/String. "foo")) (catch js/Object e :good)) > > (try (throw "foo") (catch :default e :good)) > > The "Fix" for the issue you linked didn't change "js/Object" to > ":default" in the catch all, so it didn't actually fix anything. >
I am not entirely sure what to do with this. What I did was re-open async-42 with a link to this thread -- And what is good, Phaedrus, And what is not good— Need we ask anyone to tell us these things? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to clojure+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.