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?
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 objectYeah no, that was on me. Don't (catch Exception _) in .cljc files 😉
@fb Yes, I think that would be good to have.
edamame already does this
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.
@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.
Thanks for the PR, update, and your contribution @fb!
My pleasure! It was such a tiny contribution though 😄
But valuable, yeah? And you thought of it and did it!
Yes, I'm selfish. I no longer want to parse the exception message! 😛
Selfish and generous, and good combo!