From b71d05935afec4a80ab1d54f448f46133a6ac73f Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 3 Feb 2021 22:19:47 +0100 Subject: [PATCH] :sparkles: Expose user-agent and frontend-version on error report. --- backend/resources/error-report.tmpl | 25 +++++++++++++++++++++++-- backend/src/app/http/errors.clj | 5 +++++ 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/backend/resources/error-report.tmpl b/backend/resources/error-report.tmpl index a439cea4e..3a420a60c 100644 --- a/backend/resources/error-report.tmpl +++ b/backend/resources/error-report.tmpl @@ -67,39 +67,61 @@
{{profile-id}}
{% endif %} + + {% if user-agent %}
-
VERS:
+
UAGENT:
+
{{user-agent}}
+
+ {% endif %} + + {% if frontend-version %} +
+
FVERS:
+
{{frontend-version}}
+
+ {% endif %} + +
+
BVERS:
{{version}}
+
HOST:
{{host}}
+ {% if type %}
TYPE:
{{type}}
{% endif %} + {% if code %}
CODE:
{{code}}
{% endif %} +
CLASS:
{{class}}
+
HINT:
{{hint}}
+ {% if method %}
PATH:
{{method|upper}} {{path}}
+ {% endif %} {% if params %}
@@ -128,7 +150,6 @@
{% endif %} -
TRACE:
diff --git a/backend/src/app/http/errors.clj b/backend/src/app/http/errors.clj index 391962039..b7db5b685 100644 --- a/backend/src/app/http/errors.clj +++ b/backend/src/app/http/errors.clj @@ -39,6 +39,11 @@ :hint (ex-message error) :data edata} + + (let [headers (:headers request)] + {:user-agent (get headers "user-agent") + :frontend-version (get headers "x-frontend-version" "unknown")}) + (when (and (map? edata) (:data edata)) {:explain (explain-error edata)}))))