Minor improvements on error reporting.

Add missing expound.
This commit is contained in:
Andrey Antukh 2022-01-26 14:18:44 +01:00
parent 9f7a04e330
commit 110fb2e8db
4 changed files with 22 additions and 7 deletions

View file

@ -150,14 +150,14 @@
(binding [ppr/*print-right-margin* 300]
(let [context (dissoc report
:trace :cause :params :data :spec-problems
:spec-value :error :explain :hint)
:spec-explain :spec-value :error :explain :hint)
params {:context (with-out-str (ppr/pprint context))
:hint (:hint report)
:spec-explain (:spec-explain report)
:spec-problems (:spec-problems report)
:spec-value (:spec-value report)
:data (:data report)
:trace (or (:cause report)
(:trace report)
:trace (or (:trace report)
(some-> report :error :trace))
:params (:params report)}]
(-> (io/resource "templates/error-report.tmpl")

View file

@ -12,6 +12,7 @@
[app.common.uuid :as uuid]
[clojure.pprint]
[clojure.spec.alpha :as s]
[expound.alpha :as expound]
[cuerdas.core :as str]))
(defn- parse-client-ip
@ -31,6 +32,8 @@
:params (:params request)
:spec-problems (some-> data ::s/problems)
:spec-value (some-> data ::s/value)
:spec-explain (with-out-str
(expound/printer data))
:data (some-> data (dissoc ::s/problems ::s/value :hint))
:ip-addr (parse-client-ip request)
:profile-id (:profile-id request)}