rewrite-clj

2022-09-12T09:50:57.035869Z

I'd like to catch parse errors and extract the location (row, column). Unfortunately, the ex-data thrown in reader.cljc only puts this information into the message. I have a PR ready to add row and col to ex-data, if you agree this is useful?

2022-09-12T09:52:05.790959Z

While looking into :row and :col (see above), I think I found a bug: When parsing this with ClojureScript:

(p/parse-string "(defn foo [)")
...I do not get ExceptionInfo with a useful Unmatched delimiter message like in Clojure, but: TypeError: Right-hand side of 'instanceof' is not an object

❌ 1
2022-09-12T13:34:48.822319Z

Yeah no, that was on me. Don't (catch Exception _) in .cljc files 😉

borkdude 2022-09-12T10:00:39.531889Z

@fb Yes, I think that would be good to have.

borkdude 2022-09-12T10:00:45.838459Z

edamame already does this

👍 1
2022-09-12T10:50:14.377409Z

PR here: https://github.com/clj-commons/rewrite-clj/pull/181 I think the tests will not pass because of aforementioned issue with TypeError in ClojureScript. I'm not sure if I can look into this right now and I think it is unrelated to my changes.

lread 2022-09-12T11:52:18.831429Z

@fb seems like a good idea to me too! Thanks for thinking of it and taking a stab at it. I’ll take a peek at your PR sometime soon.

👍 1
lread 2022-09-12T14:29:02.682269Z

Thanks for the PR, update, and your contribution @fb!

2022-09-12T14:32:27.661089Z

My pleasure! It was such a tiny contribution though 😄

lread 2022-09-12T14:33:23.172479Z

But valuable, yeah? And you thought of it and did it!

2022-09-12T14:34:11.446469Z

Yes, I'm selfish. I no longer want to parse the exception message! 😛

lread 2022-09-12T14:35:09.401159Z

Selfish and generous, and good combo!

😆 1