Skip to content

Commit 560e884

Browse files
fix: Removing the problematic MainThreadExceptionHandler (#475)
context: #44
1 parent a184397 commit 560e884

File tree

1 file changed

+0
-14
lines changed

1 file changed

+0
-14
lines changed

src/main/kotlin/com/statsig/sdk/StatsigServer.kt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,6 @@ private class StatsigServerImpl() :
307307

308308
override fun setup(serverSecret: String, options: StatsigOptions) {
309309
try {
310-
Thread.setDefaultUncaughtExceptionHandler(MainThreadExceptionHandler(this, Thread.currentThread()))
311310
setupStartTime = System.currentTimeMillis()
312311
errorBoundary = ErrorBoundary(serverSecret, options, statsigMetadata)
313312
coroutineExceptionHandler = CoroutineExceptionHandler { _, ex ->
@@ -1430,17 +1429,4 @@ private class StatsigServerImpl() :
14301429
diagnostics?.logDiagnostics(ContextType.INITIALIZE)
14311430
diagnostics.diagnosticsContext = ContextType.CONFIG_SYNC
14321431
}
1433-
1434-
class MainThreadExceptionHandler(val server: StatsigServer, val currentThread: Thread) :
1435-
Thread.UncaughtExceptionHandler {
1436-
override fun uncaughtException(t: Thread, e: Throwable) {
1437-
if (!t.name.equals(currentThread.name)) {
1438-
throw e
1439-
}
1440-
server.getCustomLogger()
1441-
.info("[StatsigServer] Shutting down Statsig because of unhandled exception from your server")
1442-
server.shutdown()
1443-
throw e
1444-
}
1445-
}
14461432
}

0 commit comments

Comments
 (0)