              [bindings :refer :all]
              [deployments :as deployments]
              [elasticsearch :as es]
+             [log :as log]
              [responses :refer :all]
              [tasks :as tasks]
              [util :as util]]

        (->> details
             ensure-task
             (perform-action action-fn)
             determine-next-action
             update-task
             update-deployment

    (catch Exception e
      (assoc details :result (error-with e)))))

(defn- log-error-if-necessary
  [{:keys [result] :as details}]
  (if (= (:status result) :error)
    (if-let [throwable (:throwable result)]
      (log/write (.getMessage throwable))
      (log/write "An unspecified error has occurred. It might be worth checking Exploud's logs.")))
  details)

(defn- determine-next-action
  [{:keys [message] :as details}]
  (let [{:keys [action]} message]
