                     (vec (range-error-path res))
                     " in configuration map: "
                     "value "
-                    (range-error-value res)
+                    (pr-str (range-error-value res))
                     " should be in range "
-                    (if-let [r (range-error-range res)]
-                      (range-description r)
-                      "<no range>")
+                    (let [r (range-error-range res)]
+                      (if (range? r)
+                        (range-description r)
+                        ;; FIXME: should look at this
+                        (pr-str r)))
                     " but isn't")
                res)
       (really-make-configuration res schema))))

  (letfn []
    (cond
      (map-schema? schema)
      (if (not (map? config))
        (make-range-error nil path config)
        (let [sections-map (map-schema-sections-map schema)
              res
              ;; go through the settings first, as we need to collect


  This helper assumes there are no profiles."
  [schema path c1 c2]
  (cond
    (map-schema? schema)
    (do
      (when-not (map? c1)
        (c/error `merge-config-objects-sans-profiles
                 (str "configuration at " path " is not a map: " c1)
                 path c1))
      (when-not (map? c2)
        (c/error `merge-config-objects-sans-profiles
                 (str "configuration at " path " is not a map: " c2)
                 path c2))
      (let [sections-map (map-schema-sections-map schema)
            settings-map (map-schema-settings-map schema)]
        (loop [c {}
               all-keys (seq (set/union (set (keys c1))
                                        (set (keys c2))))]
          (if all-keys
            (let [key (first all-keys)
                  val1 (get c1 key)
                  val2 (get c2 key)]
              (if (contains? settings-map key)
                (recur (assoc c 
                              ;; that `nil` is a valid value
                              key 
                              (if (contains? c2 key)
                                val2
                                val1))
                       (next all-keys))
                (if-let [section (get sections-map key)]
                  (recur (assoc c key 
                                (merge-config-objects-sans-profiles (section-schema section) (conj (vec path) key) (or val1 {}) (or val2 {})))
                         (next all-keys))
                  (c/error `merge-config-objects-sans-profiles
                           (str "unknown path " (vec (conj path key)) " in config")
                           (conj path key) (if (contains? c1 key) val1 val2) nil (if (contains? c1 key) c1 c2)))))
            c))))

    (sequence-schema? schema)
    (do
      (when-not (sequable? c1)
        (c/error `merge-config-objects-sans-profiles
                 (str "configuration at " path " is not a sequence: " (pr-str c1))
                 path c1))
      (when-not (sequable? c2)
        (c/error `merge-config-objects-sans-profiles
                 (str "configuration at " path " is not a sequence: " (pr-str c2))
                 path c2))
      
      (concat c1 c2))))

(defn merge-config-objects
  "Merge several config maps into one, with the latter taking precedence."
