Open lread opened 1 year ago
A namespaced keyword would allow usage with derive
. This is what I've done in SCI: :sci/error
for general errors.
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.
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 descendantsrewrite-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.
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.
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.