Handle exception with clojure -



Handle exception with clojure -

on clojure script have got try/catch should handle exception

datalayer (try (parse-dl line) (catch exception e []))

but when execute code i'have got exception:

caused by: com.fasterxml.jackson.core.jsonparseexception: unexpected end-of-input: expecting closing quote string value

what should ignore exceptions

this guess because don't know parse-dl does, though there mutual pattern causes exceptions thrown outside seek grab expected. if start lazy code in seek catch:

user> (def my-data [1 2 3]) #'user/my-data user> (defn my-work [data] (throw (exception. "hi"))) #'user/my-work user> (try (map my-work my-data) (catch exception e [])) exception hi user/my-work (form-init3735135586498578464.clj:1)

because map returns lazy sequence, actual computation occurs when repl prints result, exception thrown after seek grab block has returned. prepare lazy-bug, wrap map in phone call doall

user> (try (doall (map my-work my-data)) (catch exception e [])) []

another related lazy-bug occurs when lazy sequence returned with-open look time computation takes place file closed with-open macro.

exception clojure apache-pig

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -