Improve error reporting of tasks.

This commit is contained in:
Andrey Antukh 2021-02-03 17:00:35 +01:00 committed by Hirunatan
parent 816db29f9c
commit 80309cbff3
5 changed files with 50 additions and 27 deletions

View file

@ -16,6 +16,7 @@
[app.http.errors :as errors]
[app.http.middleware :as middleware]
[app.metrics :as mtx]
[app.util.log4j :refer [update-thread-context!]]
[clojure.spec.alpha :as s]
[clojure.tools.logging :as log]
[integrant.core :as ig]
@ -103,7 +104,7 @@
(catch Throwable e
(try
(let [cdata (errors/get-error-context request e)]
(errors/update-thread-context! cdata)
(update-thread-context! cdata)
(log/errorf e "Unhandled exception: %s (id: %s)" (ex-message e) (str (:id cdata)))
{:status 500
:body "internal server error"})