try and slingshot/try+ differences?

Viewed 2276

I'm trying to write an exception handler for when clj-http returns 404. According to the Exceptions section in the documentation:

clj-http will throw a Slingshot Stone that can be caught by a regular (catch Exception e ...) or in Slingshot's try+ block

Trying this, it looks like there are some differences that I have trouble figuring out:

(ns my-app.core
  (:require [clj-http.client :as client])
  (:use [slingshot.slingshot]))

(try
  (client/get "http://some-site.com/broken")
  (catch Exception e (print "I found a problem!")))

=> I found a problem!
   nil

(try+
  (client/get "http://some-site.com/broken")
  (catch Exception e (print "I found a problem!")))

=> ExceptionInfo clj-http: status 404  clj-http.client/wrap-exceptions/fn--1604 (client.clj:147)
1 Answers
Related