Browse Source

fix: catch capture errors

Tienson Qin 4 years ago
parent
commit
77eea65310
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/main/frontend/modules/instrumentation/posthog.cljs

+ 5 - 1
src/main/frontend/modules/instrumentation/posthog.cljs

@@ -39,7 +39,11 @@
       (posthog/opt_in_capturing))))
       (posthog/opt_in_capturing))))
 
 
 (defn capture [id data]
 (defn capture [id data]
-  (posthog/capture (str id) (bean/->js data)))
+  (try
+    (posthog/capture (str id) (bean/->js data))
+    (catch js/Error _e
+      ;; opt out or network issues
+      nil)))
 
 
 (comment
 (comment
   (posthog/debug))
   (posthog/debug))