Skip to content

Commit

Permalink
[ℹ️] NT-1143 Adding more info to TrackingWorker error logs (#839)
Browse files Browse the repository at this point in the history
- Added the `response.message` and `runAttemptCount` to the error message that's logged when an event fails to track.

## build.gradle
I had to add another repo for Apollo because it was causing the build to fail.
  • Loading branch information
eoji committed Apr 16, 2020
1 parent dc4b7af commit 082cbc4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/src/main/java/com/kickstarter/services/TrackingWorker.kt
Expand Up @@ -27,7 +27,7 @@ abstract class TrackingWorker(@ApplicationContext applicationContext: Context, p
Result.success()
} else {
val code = response.code()
logTrackingError(code)
logTrackingError(code, response.message())
when (code) {
in 400..499 -> {
Result.failure()
Expand All @@ -44,8 +44,8 @@ abstract class TrackingWorker(@ApplicationContext applicationContext: Context, p
Crashlytics.log(this.eventName)
}

private fun logTrackingError(code: Int) {
val errorMessage = "$code Failed to track $tag event: $eventName"
private fun logTrackingError(code: Int, message: String) {
val errorMessage = "$code Failed to track $tag event $eventName (run attempt #$runAttemptCount) $message"
if (this.build.isDebug) {
Timber.e(errorMessage)
}
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Expand Up @@ -17,6 +17,7 @@ buildscript {
allprojects {
repositories {
google()
maven { url = uri("https://dl.bintray.com/apollographql/android/") }
jcenter()
mavenCentral()
maven {
Expand Down

0 comments on commit 082cbc4

Please sign in to comment.