mirror of
https://github.com/penpot/penpot.git
synced 2025-01-09 16:30:37 -05:00
✨ Minor change on error pruning mechanism.
This commit is contained in:
parent
4c18a1881b
commit
ea218839e4
1 changed files with 9 additions and 1 deletions
|
@ -20,11 +20,19 @@
|
||||||
(get headers "x-real-ip")
|
(get headers "x-real-ip")
|
||||||
(get request :remote-addr)))
|
(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
|
(defn- stringify-data
|
||||||
[data]
|
[data]
|
||||||
(binding [clojure.pprint/*print-right-margin* 200]
|
(binding [clojure.pprint/*print-right-margin* 200]
|
||||||
(let [result (with-out-str (clojure.pprint/pprint data))]
|
(let [result (with-out-str (clojure.pprint/pprint data))]
|
||||||
(str/prune result (* 1024 1024) "[...]"))))
|
(simple-prune result (* 1024 1024)))))
|
||||||
|
|
||||||
(defn get-error-context
|
(defn get-error-context
|
||||||
[request error]
|
[request error]
|
||||||
|
|
Loading…
Reference in a new issue