Skip to content

Commit 00b84ee

Browse files
committed
Pass throwable to logger.e instead of interpolating into message
Preserves stack traces in logs when cache reads fail.
1 parent bf7951a commit 00b84ee

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • experimentation/src/main/java/com/automattic/android/experimentation/local

experimentation/src/main/java/com/automattic/android/experimentation/local/FileBasedCache.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ internal class FileBasedCache(
3232
scope.launch {
3333
withContext(context = dispatcher) {
3434
runCatching { latestMutable = getAssignments() }
35-
.onFailure { logger.e("Failed to load cached assignments: $it") }
35+
.onFailure { throwable -> logger.e("Failed to load cached assignments", throwable) }
3636
}
3737
}
3838
}
@@ -47,8 +47,8 @@ internal class FileBasedCache(
4747
return@withContext null
4848
}
4949
runCatching { cacheDtoJsonAdapter.fromJson(json) }
50-
.onFailure {
51-
logger.e("Cached assignments file is corrupted, deleting: ${file.path}")
50+
.onFailure { throwable ->
51+
logger.e("Cached assignments file is corrupted, deleting: ${file.path}", throwable)
5252
file.delete()
5353
}
5454
.getOrNull()

0 commit comments

Comments
 (0)