               (cond
                   (empty? entered-name)         (finish-processing html-renderer/render-edit-product request title product-id product-name description "danger" "Product name is not specified")
                   (empty? entered-description)  (finish-processing html-renderer/render-edit-product request title product-id product-name description "danger" "Product description is not specified")
-                  update-result                 (finish-processing html-renderer/render-edit-product request title product-id product-name description "danger" (.getMessage update-result))
+                  update-result                 (finish-processing html-renderer/render-edit-product request title product-id product-name description "danger" (utils/get-exception-message update-result))
                   :else                         (finish-processing html-renderer/render-edit-product request title product-id product-name description "info"   (str "Product " product-name " has been updated")))
               (finish-processing html-renderer/render-edit-product request title product-id product-name description))))
 

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

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

          (cond
              (empty? product-name) (finish-processing html-renderer/render-product-list request title product-list "danger" "Product name is not specified")
              (empty? description)  (finish-processing html-renderer/render-product-list request title product-list "danger" "Product description is not specified")
              insert-result         (finish-processing html-renderer/render-product-list request title product-list "danger" (utils/get-exception-message insert-result))
              :else                 (finish-processing html-renderer/render-product-list request title product-list "info"   (str "Product " product-name " has been added into the database"))
          )))

