Fork me on GitHub
#clojurescript
<
2023-05-21
>
seancorfield21:05:24

ISTR there was talk at some point of supporting Exception in catch to make it easier to write portable code -- did that go anywhere? Cljs doesn't have the dual exception hierarchy like Clojure/JVM, right? (catching Throwable should probably be considered a code smell...?)

Alex Miller (Clojure team)21:05:19

there's at least one old ticket on this, maybe one in CLJ and in CLJS

seancorfield22:05:30

Ah, the latter ticket leads to the former... 🙂 OK, so we're not likely to see portable catch any time soon, I'd imagine, given the age of that ticket.

Alex Miller (Clojure team)22:05:17

does not seem to be a burning desire even after all this time

seancorfield22:05:19

I added a vote, for what it's worth 🙂

hifumi12322:05:00

The big issue I see with the proposal is that the “portability” claims fall down the moment you need to care about the Exception or Error object in CLJ and CLJS, respectively; so I see limited value in this addition Also I agree that catching Throwable isn’t a good idea

seancorfield22:05:42

ex-message, ex-data, ex-cause help with surface portability -- it's a question of how deep into the object you need to go... what sort of things do you typically pick out of the object @U0479UCF48H?

hifumi12322:05:49

Usually getting messages or stack traces out of the object. In the case of CLJS, I typically get the message field out of an Error object and pass it back to some code that then displays some sort of alert with the error message (or logs the string somewhere with a level of ERROR).

seancorfield22:05:19

So ex-message would mostly work for you?

hifumi12322:05:28

Yeah, that sounds right.

Alex Miller (Clojure team)22:05:45

If you have feedback, please add it to the ask question page, not here