               (finish-processing html-renderer/render-chapter-list request title product-id product-name chapter-list groups-per-chapter)
               (cond
                   (empty? chapter-name) (finish-processing html-renderer/render-chapter-list request title product-id product-name chapter-list groups-per-chapter "danger" "Chapter name is not specified")
-                  insert-result         (finish-processing html-renderer/render-chapter-list request title product-id product-name chapter-list groups-per-chapter "danger" (.getMessage insert-result))
+                  insert-result         (finish-processing html-renderer/render-chapter-list request title product-id product-name chapter-list groups-per-chapter "danger" (utils/get-exception-message insert-result))
                   :else                 (finish-processing html-renderer/render-chapter-list request title product-id product-name chapter-list groups-per-chapter "info"   (str "Chapter " chapter-name " has been added into the database"))
               ))))
 

          group-name     (db-interface/read-group-name group-id)
          component-list (db-interface/read-components group-id)]
          (if delete-result
              (finish-processing html-renderer/render-component-list request title product-id chapter-id group-id product-name chapter-name group-name component-list "danger" (.getMessage delete-result))
              (finish-processing html-renderer/render-component-list request title product-id chapter-id group-id product-name chapter-name group-name component-list "info" (str "Component " component-name " has been deleted")))))

(defn get-output-format

(require '[hurvinek.html-renderer :as html-renderer])
(require '[hurvinek.exporter      :as exporter])
(require '[hurvinek.db-interface  :as db-interface])
(require '[hurvinek.utils         :as utils])

(defn println-and-flush
    "Original (println) has problem with syncing when it's called from more threads.
