I see no code to ever call

 (timbre/log :trace (str  "in catch-exceptions our reply was: " reply))   

Probably just a copy&paste error, other than that things look correct.

The JVM is complex, but strange things happening are pretty much always 
related to programmer errors.

If you add that line things should work as expected?

Cheers,
/thomas

On Thursday, October 8, 2015 at 8:35:18 AM UTC+2, Lawrence Krubner wrote:
>
> I'm thinking that I've misunderstood something about how to catch an 
> Exception. I have these 2 functions: 
>
> (defn catch-exceptions [e this-users-conversation]
>   (try 
>     (timbre/log :trace (str  "in catch-exceptions our exception was: " e))
>     (let [error (:object (ex-data e))
>           status (if (:status error)
>                    (:status error)
>                    500)
>           body (if (:body error)
>                  (:body error)
>                  (str e))
>           intent (if (:intent this-users-conversation)
>                    (:intent this-users-conversation)
>                    "api")
>           reply {:message body :status status :intent intent}]
>       reply)
>     (catch Exception e (println "in catch-exceptions we triggered this 
> exception: " e))))
>
> (defn pull-response-from-query [this-users-conversation function-to-call]
>   "Formatting exceptions as Peter requested so the iPhone app only needs 
> to check the top-level status."
>   (try
>     (function-to-call this-users-conversation)
>     (catch Exception e (catch-exceptions e this-users-conversation))))
>
>
> Testing in the terminal, and feeding in garbage in a deliberate attempt to 
> trigger the exception, I see this line over and over again: 
>
>     (timbre/log :trace (str  "in catch-exceptions our exception was: " e))
>
> but I never get this line: 
>
>       (timbre/log :trace (str  "in catch-exceptions our reply was: " 
> reply))    
>
> nor do I ever see: 
>
> "in catch-exceptions we triggered this exception: "
>
> What am I doing wrong? 
>
>
>
>
>

-- 
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/d/optout.

Reply via email to