Fix error logging with Timber
This commit is contained in:
@@ -20,7 +20,7 @@ class AuthDataSourceImpl @Inject constructor(
|
|||||||
val response = try {
|
val response = try {
|
||||||
authService.getToken(username, password)
|
authService.getToken(username, password)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Timber.e("Authenticate() exception", e)
|
Timber.e(e, "Authenticate() exception")
|
||||||
return Result.failure(e)
|
return Result.failure(e)
|
||||||
}
|
}
|
||||||
Timber.d("authenticate() response is $response")
|
Timber.d("authenticate() response is $response")
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class RecipesRemoteMediator @Inject constructor(
|
|||||||
val recipes = try {
|
val recipes = try {
|
||||||
network.requestRecipes(start = start, end = end)
|
network.requestRecipes(start = start, end = end)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Timber.e("Can't load recipes", e)
|
Timber.e(e, "Can't load recipes")
|
||||||
return MediatorResult.Error(e)
|
return MediatorResult.Error(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ class RecipesRemoteMediator @Inject constructor(
|
|||||||
PREPEND, APPEND -> storage.saveRecipes(recipes)
|
PREPEND, APPEND -> storage.saveRecipes(recipes)
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
Timber.e("Can't save recipes", e)
|
Timber.e(e, "Can't save recipes")
|
||||||
return MediatorResult.Error(e)
|
return MediatorResult.Error(e)
|
||||||
}
|
}
|
||||||
val expectedCount = end - start
|
val expectedCount = end - start
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ class AuthenticationViewModel @Inject constructor(
|
|||||||
Timber.v("authenticate() called with: username = $username, password = $password, baseUrl = $baseUrl")
|
Timber.v("authenticate() called with: username = $username, password = $password, baseUrl = $baseUrl")
|
||||||
val result = authRepo.authenticate(username, password, baseUrl)
|
val result = authRepo.authenticate(username, password, baseUrl)
|
||||||
if (result == null) Timber.d("authenticate() returns null")
|
if (result == null) Timber.d("authenticate() returns null")
|
||||||
else Timber.e("authenticate() returns error", result)
|
else Timber.e(result, "authenticate() returns error")
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user