Compatibility with raw ExceptionInfo objects #35

Closed
gfredericks opened this Issue Apr 15, 2013 · 3 comments

Comments

Projects
None yet
2 participants

I found myself wishing I could use slingshot only at the catch site -- i.e., do something like:

(throw (ex-info "Hoo ha" {:foo 8}))

and then somewhere else:

(try+ (code)
  (catch [:foo 8] _ :oops))

I'm inclined to this usage because ex-info feels like the more idiomatic thing to do, but I don't think there's any easy way (without slingshot) to catch ExceptionInfo based on the data.

Based on some cursory repl-play, I would think this should be possible to support in a backwards compatible way by applying the selectors to the :object if the ExceptionInfo was thrown by throw+ (as detected by the metadata) or to the top-level map otherwise.

If this seems reasonable I'd be happy to take a stab at it myself.

Owner

scgilardi commented Oct 4, 2014

Thanks for the suggestion. I'm sorry it took so long for me to reply. I like the idea. I did an implementation in #47 . I'd appreciate hearing any thoughts you have if you're willing to review it.

This looks good, thanks!

In the interim I've been using catch-data which I think ended up being a lot simpler since it didn't have to support older versions of Clojure.

Owner

scgilardi commented Oct 12, 2014

you're welcome! catch-data looks nice. closing this issue along with the merge of #47.

@scgilardi scgilardi closed this Oct 12, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment