                                           (string/join ","
                                            (map (fn [child]
                                                   (str "[" (:rule child) "]"
-                                                       "'" (morph child) "'"
+                                                       "'"
+
+                                                       (try
+                                                         (morph child)
+                                                         (catch Exception e
+                                                           "(exception caught)"))
+
+                                                       "'"
                                                        ))
                                                 phrasal-children))))
                           (over/overh parent phrasal-children morph)))

                        (let [result (over/overh parent (lazy-shuffle (get-lex parent :head index spec)) morph)]
                          (log/debug (str "results of attaching lexemes to: " (get-in parent [:rule]) ": (size=" (if result (.size result) "0") ")"
                                          (string/join ","
                                                       (map #(if morph (morph %1)
                                                                 "(string)")
                                                            result))))
                          result)))
                    candidate-parents)


(declare lightning-bolt)
(declare generate-all)

(defn wrapped-morph [morph-fn structure]
  (if morph-fn
    (try (let [result (morph-fn structure)]
           result)
         (catch Exception e
           (do
             (log/warn (str "ignoring exception: " e " and returning canonical form instead."))
             (strip-refs (get-in structure [:espanol])))))
    ;; TODO: consider throwing exception here.
    "(morph-fn is null)"))

(defn generate [spec grammar lexicon index morph]
  (first (take 1 (generate-all spec grammar lexicon index morph))))
