Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transport position in ex-data #181

Merged
merged 2 commits into from
Sep 12, 2022
Merged

Transport position in ex-data #181

merged 2 commits into from
Sep 12, 2022

Conversation

ferdinand-beyer
Copy link
Contributor

Exceptions thrown by the reader will have :row and :col keys in their ex-data.

@borkdude
Copy link
Collaborator

@lread I approve this PR. Maybe it would be nice to add a :type :rewrite-clj or so to the ex-data too.

@ferdinand-beyer
Copy link
Contributor Author

Note the TypeError: Right-hand side of 'instanceof' is not an object -- I think this is an unrelated issue with error reporting in ClojureScript?

@ferdinand-beyer
Copy link
Contributor Author

Argh, nevermind. The issue is my catch Exception -- that does not work in cljs. Fixing...

@lread
Copy link
Collaborator

lread commented Sep 12, 2022

Argh, nevermind. The issue is my catch Exception -- that does not work in cljs. Fixing...

Another way to fix is to catch ExceptionInfo instead.

@borkdude
Copy link
Collaborator

borkdude commented Sep 12, 2022

In some test code I write:

#?(:cljs (def Exception js/Error))

which is a hack, but it does work :)

@lread
Copy link
Collaborator

lread commented Sep 12, 2022

@lread I approve this PR. Maybe it would be nice to add a :type :rewrite-clj or so to the ex-data too.

@borkdude, I also think adding :type :rewrite-clj makes sense. I'll raise a separate issue for that.

@ferdinand-beyer
Copy link
Contributor Author

Maybe namespaced :type would make sense, eg. :rewrite-clj/parse-error. This would allow for easier integration with other tools, allows for derive -ing, and extension to different kinds of errors in the future?

@borkdude
Copy link
Collaborator

I've done something similar in SCI: :sci/error + isa?.

@lread
Copy link
Collaborator

lread commented Sep 12, 2022

Maybe namespaced :type would make sense, eg. :rewrite-clj/parse-error. This would allow for easier integration with other tools, allows for derive -ing, and extension to different kinds of errors in the future?

Yah maybe! Let's discuss in #182

@lread lread merged commit 4cd6dc7 into clj-commons:main Sep 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants