Skip to content

Commit

Permalink
Merge pull request #115 from MastodonC/fix/error-models-propagate-cor…
Browse files Browse the repository at this point in the history
…rectly

Use `contains?` rather than `if-let`
  • Loading branch information
acron0 committed Dec 21, 2015
2 parents cf44c11 + 6a0cec2 commit c5f8c75
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/witan/app/forecast.clj
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@

(defn process-error!
[{:keys [forecast-id version]} error]
(c/exec (update-forecast-error {:forecast-id forecast-id :version version :error error})))
(c/exec (update-forecast-error {:forecast-id forecast-id :version version :error (or error "No error message was provided.")})))

(defn run-model!
([forecast]
Expand All @@ -323,8 +323,8 @@
(log/info "Starting to run model: " (:model_id forecast) (:name model) (str "v" (:version model)))
(try
(let [outputs (mex/execute-model forecast model)]
(if-let [error (:error outputs)]
(process-error! forecast error)
(if (contains? outputs :error)
(process-error! forecast (:error outputs))
(let [_ (log/info "Finished running model" (:model_id forecast) "- processing...")
data (into {} (map #(process-output-data! % (:public? forecast))) outputs)]
(log/info "Finished processing model " (:model_id forecast) "-" (count data) "output(s) returned.")
Expand Down

0 comments on commit c5f8c75

Please sign in to comment.