Improve deprecation messages.

This commit is contained in:
Mike Thompson 2016-08-03 18:09:53 +10:00
parent ea2dbff974
commit fbbcfc165b
2 changed files with 5 additions and 5 deletions

View File

@ -125,16 +125,16 @@
;; Assisting the v0.0.7 -> v0.0.8 tranistion.
(defn register-handler
[& args]
(console :warn "re-frame: \"register-handler\" has been renamed \"reg-event-db\"")
(console :warn "re-frame: \"register-handler\" has been renamed \"reg-event-db\" (look for registration of " (str (first args)) ")")
(apply reg-event-db args))
(defn reg-event
[& args]
(console :warn "re-frame: \"reg-event\" has been renamed \"reg-event-db\"")
(console :warn "re-frame: \"reg-event\" has been renamed \"reg-event-db\" (look for registration of " (str (first args)) ")")
(apply reg-event-db args))
(defn register-sub
[& args]
(console :error "re-frame: \"register-sub\" is deprecated. Use \"reg-sub-raw\".")
(console :warm "re-frame: \"register-sub\" is deprecated. Use \"reg-sub-raw\" (look for registration of " (str (first args)) ")")
(apply reg-sub-raw args))

View File

@ -23,9 +23,9 @@
(let [chain (make-chain interceptors)]
(when (empty? chain)
(console :error "re-frame: when registering " id ", given an empty interceptor chain"))
(when-let [not-i (some (comp not interceptor/interceptor?) chain)]
(when-let [not-i (first (remove interceptor/interceptor? chain))]
(if (fn? not-i)
(console :error "re-frame: when registering " id ", got a function instead of an interceptor. Did you provide an old style middleware by mistake? Got: " not-i)
(console :error "re-frame: when registering " id ", got a function instead of an interceptor. Did you provide old style middleware by mistake? Got: " not-i)
(console :error "re-frame: when registering " id ", expected interceptors, but got: " not-i)))
chain)))))