This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-12-06
Channels
- # adventofcode (181)
- # aws (6)
- # beginners (112)
- # boot (38)
- # cider (11)
- # cljs-dev (12)
- # cljsrn (2)
- # clojure (187)
- # clojure-greece (31)
- # clojure-italy (19)
- # clojure-new-zealand (1)
- # clojure-poland (1)
- # clojure-spec (20)
- # clojure-uk (114)
- # clojurescript (97)
- # core-logic (25)
- # cursive (3)
- # data-science (17)
- # datascript (3)
- # datomic (23)
- # defnpodcast (1)
- # duct (5)
- # emacs (3)
- # fulcro (299)
- # graphql (108)
- # jobs (1)
- # juxt (4)
- # lein-figwheel (7)
- # leiningen (1)
- # lumo (9)
- # nrepl (2)
- # off-topic (10)
- # om (2)
- # onyx (36)
- # pedestal (1)
- # perun (3)
- # re-frame (14)
- # reagent (12)
- # ring (2)
- # rum (11)
- # shadow-cljs (6)
- # spacemacs (4)
- # unrepl (8)
I've got re-graph to its first release: https://github.com/oliyh/re-graph
anyone have any tips on tracking down which event is causing a spec validation to fail? I have a similar setup to the re-frame todomvc which is working well but when something fails it would be extremely helpful to know which reg-event-db
or reg-event-fx
caused the failure
@jonr If you check the spec in an interceptor, you have full access to the context that contain the event vector.
I was just using after
(again taken form the TODOMVC) but will I need to make my own interceptor which does something like pass on the context to the spec validation so it can log/print it?
@jonr Here's how I do it:
(defn check-and-throw
"throw an exception if db doesn't match the spec."
[a-spec db event]
(when-not (sp/valid? a-spec db)
(let [data (sp/explain-data a-spec db)]
(throw (ex-info "DB spec check failed" (assoc data :db db :event event))))))
(def check-spec-i (after (fn [db event]
(when db
(check-and-throw :some.ns/db-spec db event)))))
I'm still pretty new to re-frame, is it common/idiomatic to spec validate the entire db?