From 17ac9060e3870521fd0a6adb7adc7917de96fe0e Mon Sep 17 00:00:00 2001 From: James Fenn Date: Tue, 23 Jun 2020 20:53:05 -0400 Subject: [PATCH] update readme, add error logging --- README.md | 2 +- .../kotlin/me/jfenn/gitrest/RequestProviderDelegate.kt | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e01affd..4af2cc0 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ To add the dependency to a module, copy this line into your app's build.gradle f implementation "dev.horrific.code.james.git-rest-wrapper:gitrest-jvm:$gitrest_version" ``` -The Android dependency can be imported similarly, using the `-android` dependency instead of `-jvm` (this isn't strictly necessary, but it does exclude a couple dependencies in place of Android APIs, reducing your overall APK size). +The Android dependency can be imported similarly, using the root `gitrest` dependency instead of `gitrest-jvm`. Gradle should identify & download the `gitrest-android` variant automatically? Either way, if you specify `gitrest-android` explicitly, your project won't compile. I don't know why this happens, only that I've spent far too long working this out and have other things to do. ```groovy implementation "dev.horrific.code.james.git-rest-wrapper:gitrest-android:$gitrest_version" diff --git a/gitrest/src/commonMain/kotlin/me/jfenn/gitrest/RequestProviderDelegate.kt b/gitrest/src/commonMain/kotlin/me/jfenn/gitrest/RequestProviderDelegate.kt index 0cef4f1..96f6d19 100644 --- a/gitrest/src/commonMain/kotlin/me/jfenn/gitrest/RequestProviderDelegate.kt +++ b/gitrest/src/commonMain/kotlin/me/jfenn/gitrest/RequestProviderDelegate.kt @@ -9,7 +9,8 @@ import me.jfenn.gitrest.model.* class RequestProviderDelegate( private val services: Array> = arrayOf(GithubProvider, GitlabProvider, GiteaProvider), - private val strictMode: Boolean = false + private val strictMode: Boolean = false, + private val logError: (String) -> Unit = { println(it) } // TODO: implement a more robust log handler + check BuildConfig.DEBUG before logging ) : RequestProvider { private val providers: MutableMap = HashMap() @@ -34,6 +35,7 @@ class RequestProviderDelegate( } } catch (e: Exception) { if (strictMode) throw e + else logError("GIT-REST: Error fetching ${str}: ${e::class.simpleName} - ${e.message}") null } } -- GitLab