From 433e04ee9eb3c6fa23fbdb8342f83fc7ba5517b3 Mon Sep 17 00:00:00 2001 From: Abhay Sood Date: Mon, 26 Aug 2024 17:49:13 +0530 Subject: [PATCH 1/2] chore(android): add thread name explicitly to exception --- .../main/java/sh/measure/android/exceptions/ExceptionData.kt | 5 +++++ .../java/sh/measure/android/exceptions/ExceptionFactory.kt | 1 + 2 files changed, 6 insertions(+) diff --git a/android/measure/src/main/java/sh/measure/android/exceptions/ExceptionData.kt b/android/measure/src/main/java/sh/measure/android/exceptions/ExceptionData.kt index 7913d4ff7..10183c13b 100644 --- a/android/measure/src/main/java/sh/measure/android/exceptions/ExceptionData.kt +++ b/android/measure/src/main/java/sh/measure/android/exceptions/ExceptionData.kt @@ -53,6 +53,11 @@ internal data class ExceptionUnit( * A list of stack frames for the exception. */ val frames: List, + + /** + * The thread name where the exception occurred. + */ + val thread_name: String, ) /** diff --git a/android/measure/src/main/java/sh/measure/android/exceptions/ExceptionFactory.kt b/android/measure/src/main/java/sh/measure/android/exceptions/ExceptionFactory.kt index dc12308dc..c5f8b6383 100644 --- a/android/measure/src/main/java/sh/measure/android/exceptions/ExceptionFactory.kt +++ b/android/measure/src/main/java/sh/measure/android/exceptions/ExceptionFactory.kt @@ -27,6 +27,7 @@ internal object ExceptionFactory { line_num = it.lineNumber, ) }, + thread_name = thread.name, ) exceptions.add(exception) error = error.cause From c90e70b7dd5d1b6e859db1004212758c2ce9f926 Mon Sep 17 00:00:00 2001 From: Abhay Sood Date: Mon, 26 Aug 2024 17:49:36 +0530 Subject: [PATCH 2/2] refactor(android): remove unused code --- .../sh/measure/android/exceptions/ExceptionFactoryTest.kt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/android/measure/src/test/java/sh/measure/android/exceptions/ExceptionFactoryTest.kt b/android/measure/src/test/java/sh/measure/android/exceptions/ExceptionFactoryTest.kt index 4f8e64f5f..1f339c967 100644 --- a/android/measure/src/test/java/sh/measure/android/exceptions/ExceptionFactoryTest.kt +++ b/android/measure/src/test/java/sh/measure/android/exceptions/ExceptionFactoryTest.kt @@ -4,12 +4,8 @@ import org.junit.Assert.assertEquals import org.junit.Assert.assertFalse import org.junit.Assert.assertTrue import org.junit.Test -import sh.measure.android.fakes.FakeTimeProvider class ExceptionFactoryTest { - - private val timeProvider = FakeTimeProvider() - @Test fun `ExceptionFactory creates a single exception when exception has no cause`() { // Given