ClojureDocs

导航

命名空间

error-handler

clojure.core

自 1.2 版本提供 (源代码)
  • (error-handler a)
Returns the error-handler of agent a, or nil if there is none.
See set-error-handler!
1 Example
(def error-atom (atom []))

(def a (agent ""
              :validator string?
              :error-handler (fn [agnt ex]
                               (swap! error-atom
                                      conj
                                      {:agent agnt
                                       :exception (.getMessage ex)}))))

(send a 1) ;; will fail validation

@error-atom
[{:agent #<Agent@c47f284: "">,
  :exception "java.lang.Long cannot be cast to clojure.lang.IFn"}]

(error-handler a)
#<core$fn__11922 user$fn__11922@2a6b59c>
See Also

Sets the error-handler of agent a to handler-fn. If an action being run by the agent throws an ex...

Added by devn

Creates and returns an agent with an initial value of state and zero or more options (in any order...

Added by devn
0 Notes
No notes for error-handler