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

Identity ex-info exceptions as being thrown from rewrite-clj #182

Open
lread opened this issue Sep 12, 2022 · 4 comments
Open

Identity ex-info exceptions as being thrown from rewrite-clj #182

lread opened this issue Sep 12, 2022 · 4 comments

Comments

@lread
Copy link
Collaborator

lread commented Sep 12, 2022

Problem/Opportunity
Rewrite-clj throws ex-info exceptions.
It would be nice if a caller could easily tell if they came from rewrite-clj.

Proposed Solution
@borkdude suggested adding :type :rewrite-clj to ex-data.

Alternative Solutions
None at this time.

Action
I can follow up with a PR sometime soon.

@borkdude
Copy link
Collaborator

A namespaced keyword would allow usage with derive. This is what I've done in SCI: :sci/error for general errors.

@lread
Copy link
Collaborator Author

lread commented Sep 12, 2022

A namespaced keyword would allow usage with derive. This is what I've done in SCI: :sci/error for general errors.

Cool, thanks, I'll take a peek at sci for inspiration.

@lread lread added this to rewrite-clj Jul 3, 2024
@lread lread moved this to High Priority (next release) in rewrite-clj Jul 3, 2024
@lread lread moved this from High Priority (next release) to In Progress in rewrite-clj Jul 6, 2024
@lread
Copy link
Collaborator Author

lread commented Jul 6, 2024

While I'm looking at exceptions I've started to look at this one.

Following sci's example we'll have a base exception :type of :rewrite-clj/error.

It will have descendants:

  • rewrite-clj.error/parse will have descendants:
    • rewrite-clj.error/unmatched-delimiter
    • rewrite-clj.error/eof (could optionally distinguish different reasons for eof with descendants, but probably won't yet)
    • rewrite-clj.error/invalid will have descendants
      • rewrite-clj.error/invalid-keyword
      • rewrite-clj.error/invalid-symbol
      • rewrite-clj.error/invalid-namespaced-map
      • ...

I'll review and update as I work my way through what rewrite-clj currently throws.
(and what our usage of tools.reader currently throws, for that matter).

As always, feedback and ideas are welcome.

@lread
Copy link
Collaborator Author

lread commented Jul 7, 2024

An alternative to being very granular for invalid errors is to include what rewrite-clj was trying to parse as a separate map entry in the ex-info data. Our node tag is not terribly granular so this might send me to finally look at #114.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

No branches or pull requests

2 participants