mirror of
https://github.com/penpot/penpot.git
synced 2025-01-08 16:00:19 -05:00
📎 Improve error reporting.
This commit is contained in:
parent
455b0efa71
commit
7c98336148
2 changed files with 6 additions and 39 deletions
|
@ -95,33 +95,3 @@
|
|||
[{:v1 (alength (blob/encode data {:version 1}))
|
||||
:v2 (alength (blob/encode data {:version 2}))
|
||||
:v3 (alength (blob/encode data {:version 3}))}]))
|
||||
|
||||
(defn update-page-1
|
||||
[data]
|
||||
(letfn [(find-empty-groups [objects]
|
||||
(->> (vals objects)
|
||||
(filter (fn [shape]
|
||||
(and (= :group (:type shape))
|
||||
(or (empty? (:shapes shape))
|
||||
(every? (fn [child-id]
|
||||
(not (contains? objects child-id)))
|
||||
(:shapes shape))))))
|
||||
(map :id)))
|
||||
|
||||
(update-page [[page-id page]]
|
||||
(let [objects (:objects page)
|
||||
eids (find-empty-groups objects)]
|
||||
|
||||
(map (fn [id]
|
||||
{:type :del-obj
|
||||
:page-id page-id
|
||||
:id id})
|
||||
eids)))]
|
||||
(loop [i 0 data data]
|
||||
(let [changes (mapcat update-page (:pages-index data))]
|
||||
(prn "==== loop " i " ====")
|
||||
(clojure.pprint/pprint changes)
|
||||
(if (seq changes)
|
||||
(recur (inc i)
|
||||
(app.common.pages.changes/process-changes data changes))
|
||||
data)))))
|
||||
|
|
|
@ -63,15 +63,12 @@
|
|||
[cfg {:keys [host version id] :as cdata}]
|
||||
(try
|
||||
(let [uri (:uri cfg)
|
||||
text (str "Unhandled exception:\n"
|
||||
"- detail: " (cfg/get :public-uri) "/dbg/error-by-id/" id "\n"
|
||||
"- profile-id: `" (:profile-id cdata) "`\n"
|
||||
"- host: `" host "`\n"
|
||||
"- version: `" version "`\n")
|
||||
rsp (http/send! {:uri uri
|
||||
:method :post
|
||||
:headers {"content-type" "application/json"}
|
||||
:body (json/encode-str {:text text})})]
|
||||
text (str "Unhandled exception (host: " host ", url: " (cfg/get :public-uri) "/dbg/error-by-id/" id "\n"
|
||||
"- profile-id: #" (:profile-id cdata) "\n")
|
||||
rsp (http/send! {:uri uri
|
||||
:method :post
|
||||
:headers {"content-type" "application/json"}
|
||||
:body (json/encode-str {:text text})})]
|
||||
(when (not= (:status rsp) 200)
|
||||
(l/error :hint "error on sending data to mattermost"
|
||||
:response (pr-str rsp))))
|
||||
|
|
Loading…
Reference in a new issue