How I can catch exception from cheshire.core?

2013-09-11 Thread Алексей Александров
Hello. I'm trying catch exception from cheshire.core/decode (or parse-string). But it didn't work user= (require ['cheshire.core :as 'json]) user= (try (json/decode [{\id\:ty\:1}]) (catch Throwable _ (println I catched exception))) JsonParseException Unrecognized token 'ty': was expecting at

Re: How I can catch exception from cheshire.core?

2013-09-11 Thread Cedric Greevey
Is json/decode returning a lazy seq? If so, you're constructing it inside the try and then realizing it outside the try, and the exception may be coming from the realization step. On Wed, Sep 11, 2013 at 4:56 AM, Алексей Александров alexeyaleksand...@gmail.com wrote: Hello. I'm trying catch

Re: How I can catch exception from cheshire.core?

2013-09-11 Thread Алексей Александров
Yes, json/decode return clojure.lang.LazySeq. I added (doall ) to force calculation. Thank you. 2013/9/11 Cedric Greevey cgree...@gmail.com Is json/decode returning a lazy seq? If so, you're constructing it inside the try and then realizing it outside the try, and the exception may be

Re: How I can catch exception from cheshire.core?

2013-09-11 Thread Norman Richards
On Wednesday, September 11, 2013 5:29:39 AM UTC-5, Алексей Александров wrote: Yes, json/decode return clojure.lang.LazySeq. I added (doall ) to force calculation. This bit me on a project yesterday. I also added a doall, but I haven't had time to investigate whether any of the interior