diff --git a/backend/resources/templates/error-report.tmpl b/backend/resources/templates/error-report.tmpl index bf9748862..a3fcc158d 100644 --- a/backend/resources/templates/error-report.tmpl +++ b/backend/resources/templates/error-report.tmpl @@ -9,6 +9,12 @@ penpot - error report {{id}}
[]
[context]
[request params]
+ {% if data %} +
[error data]
+ {% endif %} + {% if spec-explain %} +
[spec explain]
+ {% endif %} {% if spec-problems %}
[spec problems]
{% endif %} @@ -16,9 +22,6 @@ penpot - error report {{id}}
[spec value]
{% endif %} - {% if data %} -
[error data]
- {% endif %} {% if trace %}
[error trace]
{% endif %} @@ -55,6 +58,15 @@ penpot - error report {{id}} {% endif %} + {% if spec-explain %} +
+
SPEC EXPLAIN:
+
+
{{spec-explain}}
+
+
+ {% endif %} + {% if spec-problems %}
SPEC PROBLEMS:
diff --git a/backend/src/app/http/debug.clj b/backend/src/app/http/debug.clj index 39e597343..2098cd084 100644 --- a/backend/src/app/http/debug.clj +++ b/backend/src/app/http/debug.clj @@ -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") diff --git a/backend/src/app/http/errors.clj b/backend/src/app/http/errors.clj index 216fe9127..e8686d87c 100644 --- a/backend/src/app/http/errors.clj +++ b/backend/src/app/http/errors.clj @@ -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)} diff --git a/common/src/app/common/logging.cljc b/common/src/app/common/logging.cljc index 6800253c3..aea40b935 100644 --- a/common/src/app/common/logging.cljc +++ b/common/src/app/common/logging.cljc @@ -180,7 +180,7 @@ `(->> (ThreadContext/getImmutableContext) (send-off logging-agent (fn [_# cdata#] - (with-context (into {:cause ~cause} cdata#) + (with-context (into {} cdata#) (->> (or ~raw (build-map-message ~props)) (write-log! ~logger-sym ~level-sym ~cause))))))