     ([k v] (= k (:error-key error-data)))
     ([x] (= x (:error-value error-data)))))
 
+(defn print-multi-line-error [[msg & more :as all] left]
+  (when (seq all)
+    (println (a/magenta (str (pad (+ left)) "^-- " msg)))
+    (doseq [m more]
+      (println (a/magenta (str (pad (+ left)) "    " m))))))
+
 (defn display-err-map-or-val
   ([msgs] (display-err-map-or-val msgs 0))
-  ([[msg & more :as all] extra]
+  ([all extra]
    (fn
      ([left k v]
       (println (str (pad left) (a/bold-red (str (pr-str k) " " (pr-str v)))))
-      (when (seq all)
-        (println (a/magenta (str (pad (+ left extra)) "^-- " msg)))
-        (doseq [m more]
-          (println (a/magenta (str (pad (+ left extra)) "    " m))))))
+      (print-multi-line-error all left))
      ([left x]
       (println (str (pad left) (a/bold-red (str (pr-str x)))))
-      (when (seq all)
-        (println (a/magenta (str (pad (+ left extra)) "^-- " msg)))
-        (doseq [m more]
-          (println (a/magenta (str (pad (+ left extra)) "    " m)))))))))
+      (print-multi-line-error all left)))))
 
 (defn matches-faulty-key? [k v elements faulty-key]
   (some #{k v} #{faulty-key}))

    (show-footer)))

(defn map-conditional-failed*
  [job error-data structure-type faulty-key context pred]
  (let [entry (get-in model [(structure-names structure-type) :model faulty-key])
        msg (predicate-error-msg context (assoc error-data :predicate pred))
        error-f
        (fn [k v]
          (println "  " (a/bold-red (str (pr-str k) " " (pr-str v))))
          (doseq [m msg]
            (println (str "   " (a/magenta m)))))]
    (show-header structure-type faulty-key)
    (show-map context faulty-key matches-map-key? error-f)
    (show-docs entry faulty-key)
    (show-footer)))


    (str (apply str result) raw)))

(defn closest-match [choices faulty-key]
  (when (keyword? faulty-key)
    (let [faulty-str (name faulty-key)
          distances
          (map
           (fn [k]
             [k (levenshtein faulty-str (name k))])
           choices)]
      (when (seq distances)
        (let [candidate (apply min-key second distances)]
          ;; Don't guess wildly. Make sure it's at least
          ;; a guess within reason.
          (when (<= (second candidate) 5)
            (first candidate)))))))

(defn show-header [structure-type faulty-key]
  (println "------ Onyx Job Error -----")
