Browse Source

enhance: sent graphs-txid in sentry events

Tienson Qin 2 years ago
parent
commit
39d23a8671
2 changed files with 9 additions and 3 deletions
  1. 2 1
      src/main/frontend/format/block.cljs
  2. 7 2
      src/main/frontend/handler/events.cljs

+ 2 - 1
src/main/frontend/format/block.cljs

@@ -29,7 +29,8 @@ and handles unexpected failure."
                               :date-formatter (state/get-date-formatter)})
     (catch :default e
       (log/error :exception e)
-      (Sentry/captureException e)
+      (state/pub-event! [:capture-error {:error e
+                                         :payload {:type "Extract-blocks"}}])
       (notification/show! "An unexpected error occurred during block extraction." :error)
       [])))
 

+ 7 - 2
src/main/frontend/handler/events.cljs

@@ -419,8 +419,13 @@
   (posthog/capture type payload))
 
 (defmethod handle :capture-error [[_ {:keys [error payload]}]]
-  (Sentry/captureException error
-                           (bean/->js {:extra payload})))
+  (let [[user-uuid graph-uuid tx-id] @sync/graphs-txid
+        payload (assoc payload
+                       :user-id user-uuid
+                       :graph-id graph-uuid
+                       :tx-id tx-id)]
+    (Sentry/captureException error
+                            (bean/->js {:extra payload}))))
 
 (defmethod handle :exec-plugin-cmd [[_ {:keys [pid cmd action]}]]
   (commands/exec-plugin-simple-command! pid cmd action))