   [key]
   (om/transact! reconciler `[(change/view {:view ~key})]))
 
+
+;;;; Error messages
+(defn error?
+  "Return boolean if there is an error message."
+  []
+  (let [message (get-in @app-state [:error :message])]
+    (pos? (count message))))
+
+(defn error!
+  "Set error message."
+  [message]
+  (om/transact! reconciler `[(update/error {:message ~message})]))
+
+(defn no-error!
+  "Reset error message."
+  []
+  (error! nil))
+
+(defn get-error
+  "Return error message."
+  []
+  (get-in @app-state [:error :message]))
+
 ;;;; State transitions
 (defn update-pokemon!
   "Update pokemon based on API response."

  [{:keys [state]} _ {:keys [view]}]
  {:action (fn [] (swap! state update-in [:user :view] (fn [] view)))})

(defmethod mutate 'increment
    [{:keys [state]} _ {:keys [pokemon]}]
    {:action (fn [] (swap! state update-in [:count] inc))})

(defonce reconciler
         (om/reconciler

         (atom
           {:pokemon []
            :user {:view :default
                   :logged-in? false}
            :error {:message nil}}))


;;;; React compatibility
