 
 (defn- mark-as-failed
   [conn task error]
-  (let [error (string-strack-trace error)
-        sqlv [sql:mark-as-failed error (:id task)]]
+  (let [explain (ex-message error)
+        sqlv [sql:mark-as-failed explain (:id task)]]
     (-> (db/query-one conn sqlv)
         (p/then' (constantly nil)))))
 


(defn- reschedule
  [conn task error]
  (let [explain (string-strack-trace error)
        sqlv [sql:mark-as-retry explain (:id task)]]
    (-> (db/query-one conn sqlv)
        (p/then' (constantly nil)))))

         :or {delay 0 props {} queue "default"}
         :as options}]
  (us/verify ::task-options options)
  (let [duration (tm/duration delay)
        pginterval (duration->pginterval duration)
        props (blob/encode props)]
    (log/info "Schedule task" name
              ;; "with props" (pr-str props)
              "to be executed in" (str duration))
    (-> (db/query-one conn  [sql:insert-new-task name props queue pginterval])
        (p/then' (fn [task] (:id task))))))
