0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-09 00:10:11 -05:00

Minor change on error pruning mechanism.

This commit is contained in:
Andrey Antukh 2021-11-17 11:10:28 +01:00
parent 4c18a1881b
commit ea218839e4

View file

@ -20,11 +20,19 @@
(get headers "x-real-ip")
(get request :remote-addr)))
(defn- simple-prune
([s] (simple-prune s (* 1024 1024)))
([s max-length]
(if (> (count s) max-length)
(str (subs s 0 max-length) " [...]")
s)))
(defn- stringify-data
[data]
(binding [clojure.pprint/*print-right-margin* 200]
(let [result (with-out-str (clojure.pprint/pprint data))]
(str/prune result (* 1024 1024) "[...]"))))
(simple-prune result (* 1024 1024)))))
(defn get-error-context
[request error]