So, thanks to Michael Klishin, Aaron Cohen, Frank Siebenlist and Craig
Brozefsky I am now able to correctly ping the Omniture API. But I am
getting a strange behavior from the clj-http library. It makes 4 calls
to the API server, even though the first call is successful.

When I look here:

https://github.com/dakrone/clj-http

I see it says:

;; Apache's http client automatically retries on IOExceptions, if you
;; would like to handle these retries yourself, you can specify a
;; :retry-handler.

So, since it re-tries, I should assume that it is encountering an
IOException. But I get a successful response on the first try, so what
would the IOException be?

Because clj-http uses Slingshot, I have wrapped it in a "try+ / catch
Object o" block. And I print the "o" to the terminal, and yet I am not
seeing anything in the terminal. So where is the IOException? How do I
find it?

This is the actual function I use to ping the Omniture API:

(defn omniture-call-api [url-with-queue-method api-payload headers]
  (timbre/spy :debug " return value of omniture-call-api "
              (try+
                (http-client/post url-with-queue-method
                                  {:body api-payload
                                   :debug true
                                   :debug-body true
                                   :insecure true
                                   :headers {"X-Api-Version" "2"
                                             "X-WSSE" headers}
                                   :content-type :json
                                   :socket-timeout 4000
                                   :conn-timeout 4000
                                   :accept :json
                                   :client-params
{"http.protocol.allow-circular-redirects" true
                                                   "http.useragent"
"clj-http"}})
                (catch Object o (println (pp/pprint o))))))

If there is an IOException, why doesn't this line catch it?

                (catch Object o (println (pp/pprint o))

I read here that "catch Object o" is the correct way to catch
everything, using Slingshot:

https://github.com/scgilardi/slingshot/issues/24

So why would I not see this error?






-- 
-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to