diff --git a/CHANGES.md b/CHANGES.md index e1ea698..b7d1a33 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -23,6 +23,7 @@ #### Minor Fixes and Improvements + - [#400](https://github.com/Day8/re-frame/pull/400) Improve error message when a registered cofx can't be found - The effect handler for `:dispatch-n` will now ignore `nils`. [See checkin](https://github.com/Day8/re-frame/commit/6efdae438f393f8121a2d6dfbf76db00e6dafbf5) - [#340](https://github.com/Day8/re-frame/pull/340) - [#341](https://github.com/Day8/re-frame/pull/341) Fix `re-frame.core/on-changes` to work even if event handler does not set `:db`. diff --git a/docs/CodeWalkthrough.md b/docs/CodeWalkthrough.md index 0ed40ed..6517753 100644 --- a/docs/CodeWalkthrough.md +++ b/docs/CodeWalkthrough.md @@ -62,7 +62,7 @@ informal description, and here it is ... for this app `app-db` will contain a two-key map like this: ```cljs {:time (js/Date.) ;; current time for display - :time-color "#f88"} ;; the colour in which the time should be be shown + :time-color "#f88"} ;; the colour in which the time should be shown ``` re-frame itself owns/manages `app-db` (see FAQ #1), and it will diff --git a/src/re_frame/cofx.cljc b/src/re_frame/cofx.cljc index 9b1ecab..ec2668d 100644 --- a/src/re_frame/cofx.cljc +++ b/src/re_frame/cofx.cljc @@ -83,13 +83,17 @@ :id :coeffects :before (fn coeffects-before [context] - (update context :coeffects (get-handler kind id))))) + (if-let [handler (get-handler kind id)] + (update context handler :coeffects) + (console :error "No cofx handler registered for \"" id "\""))))) ([id value] (->interceptor :id :coeffects :before (fn coeffects-before [context] - (update context :coeffects (get-handler kind id) value))))) + (if-let [handler (get-handler kind id)] + (update context :coeffects handler value) + (console :error "No cofx handler registered for \"" id "\"")))))) ;; -- Builtin CoEffects Handlers ---------------------------------------------