Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Compatibility with raw ExceptionInfo objects #35

Closed
gfredericks opened this Issue · 3 comments

2 participants

@gfredericks

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.

@scgilardi
Owner

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.

@gfredericks

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.

@scgilardi
Owner

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

@scgilardi scgilardi closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.