Add PostHog exception capture for crash reporting

Android: uncaught exception handler sends $exception events with stack
trace to PostHog, flushes before delegating to default handler.
iOS: NSSetUncaughtExceptionHandler captures crashes via PostHogSDK,
avoids @MainActor deadlock by calling SDK directly.
Common: captureException() available for non-fatal catches app-wide.
Platform stubs for jvm/js/wasmJs.
This commit is contained in:
Trey T
2026-03-26 16:49:30 -05:00
parent af73f8861b
commit e4dc3ac30b
9 changed files with 138 additions and 0 deletions

View File

@@ -8,9 +8,11 @@ expect object PostHogAnalytics {
fun initialize()
fun identify(userId: String, properties: Map<String, Any>? = null)
fun capture(event: String, properties: Map<String, Any>? = null)
fun captureException(throwable: Throwable, properties: Map<String, Any>? = null)
fun screen(screenName: String, properties: Map<String, Any>? = null)
fun reset()
fun flush()
fun setupExceptionHandler()
}
/**