Saner error handling in analytics/log-event
This commit is contained in:
parent
344e8734c1
commit
bd271169ea
@ -31,12 +31,14 @@
|
|||||||
"Logs an event to Amplitude. Returns a channel that resolves with the response from Amplitude"
|
"Logs an event to Amplitude. Returns a channel that resolves with the response from Amplitude"
|
||||||
([event-name properties]
|
([event-name properties]
|
||||||
(let [res-channel (chan)]
|
(let [res-channel (chan)]
|
||||||
(when (and (not (do-not-track)) (exists? js/amplitude))
|
(when (not (do-not-track))
|
||||||
(.logEvent (.getInstance js/amplitude)
|
(if-not (exists? js/amplitude)
|
||||||
event-name
|
(log/error "Unable to get Amplitude instance. Did you call init-amplitude?")
|
||||||
(clj->js properties)
|
(.logEvent (.getInstance js/amplitude)
|
||||||
(fn [response-code response-body]
|
event-name
|
||||||
(go (>! res-channel {:code response-code
|
(clj->js properties)
|
||||||
:body response-body})))))
|
(fn [response-code response-body]
|
||||||
|
(go (>! res-channel {:code response-code
|
||||||
|
:body response-body}))))))
|
||||||
res-channel))
|
res-channel))
|
||||||
([event-name] (log-event event-name nil)))
|
([event-name] (log-event event-name nil)))
|
||||||
|
Loading…
Reference in New Issue
Block a user